Backport #3810: bounds check iChanID before array access (release/3_12) - #3840
Backport #3810: bounds check iChanID before array access (release/3_12)#3840mcfnord wants to merge 2 commits into
Conversation
ann0see
left a comment
There was a problem hiding this comment.
I don't like this inlining: we should ship the same code as on main.
|
MY LLM WROTE: @ann0see Fair — pushed Verified: |
|
OK, that's small enough. |
|
I still prefer the exact same commits cherry picked. |
dingodoppelt
left a comment
There was a problem hiding this comment.
I'd prefer cherry-picking the original commits. We didn't squash on merge so there are a few which could be squashed only for this backport.
…, jamulussoftware#3812) release/3_12 needs MathUtils::InRange for the jamulussoftware#3810 bounds-check backport, but jamulussoftware#3741 introduced it as part of a much larger server chat-handling refactor (new CServer::SendChatTextToConChannel / SendChatTextToAllConChannels methods) that this branch does not have and is out of scope for a bug-fix backport. This squashes just the src/util.h hunks from the six main commits that shaped MathUtils::InRange into its current form, in order, omitting every hunk outside util.h: 562d6c6 Refactor server chat handling by extracting methods. Added range check method to MathUtils (jamulussoftware#3741) 4f9a532 Clarify comment (jamulussoftware#3741) 6d305cb Check for half open interval in MathUtils::InRange (jamulussoftware#3812) 65513e5 Update src/util.h (jamulussoftware#3812) fe98b1a Fix style (jamulussoftware#3812) Result is byte-for-byte identical to MathUtils::InRange on main.
Switch bounds check to use MathUtils Fix channel ID range check in audiomixerboard (cherry picked from commit 562cfd8)
57525a2 to
f018042
Compare
|
MY LLM WROTE: Force-pushed with actual cherry-picks instead of the hand-written equivalent.
Net result is identical to the previous push, plus one line I'd missed: the Verified: |
MY LLM WROTE:
Backports #3810's fix to
release/3_12. A straight cherry-pick of562cfd84doesn't apply here: it callsMathUtils::InRange, which doesn't exist on this branch — it was added by #3741 and only reached its current half-open-interval semantics via #3812, neither of which is onrelease/3_12. Rather than backport that dependency chain too, this inlines the equivalent bounds check directly, with the same effect:iChanIDarrives off the wire as an unvalidated value and this branch'sApplyNewConClientListhad no check before indexing a 150-entry stack array with it.Verified:
-fsyntax-onlyclean,clang-formatunchanged, full client build (qmake && make) compiles and links with no errors. Onlysrc/audiomixerboard.cpptouched.Fixes the same issue as #3810, for
release/3_12.