Fix uint64_t overflow in SectionBMC bounds check - #9962
Closed
stsoe wants to merge 1 commit into
Closed
Conversation
#### Problem solved by the commit copyBufferUpdateMetadata() computed `pHdr->m_offset + pHdr->m_size` as a uint64_t addition before comparing against _origSectionSize. If both fields are near UINT64_MAX the addition wraps silently, causing the bounds check to pass on a malformed section. #### Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered Found during triage of AIESW-41122/41123 (false positives). The overflow was latent in the original check predating bb1791f. #### How problem was solved, alternative solutions (if any) and why they were rejected Replaced the addition with an overflow-safe two-part check: m_size > _origSectionSize || m_offset > _origSectionSize - m_size #### Risks (if any) associated the changes in the commit Low. Semantically equivalent for all non-overflow inputs; only rejects crafted inputs that previously slipped past the check. #### What has been tested and how, request additional testing if necessary Built xclbinutil successfully. #### Documentation impact (if any) None Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com> Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
xfreid
approved these changes
Aug 5, 2026
Collaborator
Author
|
Replaced by #9966 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem solved by the commit
copyBufferUpdateMetadata() computed
pHdr->m_offset + pHdr->m_sizeas a uint64_t addition before comparing against _origSectionSize. If both fields are near UINT64_MAX the addition wraps silently, causing the bounds check to pass on a malformed section.Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered Found during triage of AIESW-41122/41123 (false positives). The overflow was latent in the original check predating bb1791f.
How problem was solved, alternative solutions (if any) and why they were rejected Replaced the addition with an overflow-safe two-part check:
m_size > _origSectionSize || m_offset > _origSectionSize - m_size
Risks (if any) associated the changes in the commit Low. Semantically equivalent for all non-overflow inputs; only rejects crafted inputs that previously slipped past the check.
What has been tested and how, request additional testing if necessary Built xclbinutil successfully.
Documentation impact (if any)
None