Repository navigation
Fix numeric overflow checks in size classes - #2926
Merged
Merged
Conversation
spredolac
force-pushed
the
numeric_errors_issue_2925
branch
from
May 26, 2026 20:21
be086ac to
cccef0b
Compare
guangli-dai
approved these changes
May 26, 2026
guangli-dai
left a comment
Contributor
There was a problem hiding this comment.
LGTM, since CI is green, we can merge once @brookheather confirms that it passes Veracode checks.
|
Thanks for the quick response however I will need a branch or tag with this change in it to download it on our side (internally I need to provide just a URL) and then I can get it scanned with Veracode. |
Contributor
Author
|
I will merge into |
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.

This should address issue #2925
I do not have veracode to run locally, but based on description this should fit.
This change does not affect the ordinary malloc() fast path.
sz_sa2u()logic is only reached for aligned allocations.SC_LARGE_MAXCLASSis expressed as pointer-width constant instead of macro arithmetic.configure.aconly supportsLG_SIZEOF_PTR == 2or3(32-bit or 64-bit pointers, with the same MSVC mapping), so the constants are equivalent while avoiding arithmetic expansion atjemalloc.cuse sites (one of them most likely reported by veracode).For
sz_sa2u(), zero alignment now returns0before computingalignment - 1. Power-of-two alignment is internal caller contract enforced by the existing assert in debug build (all current callers respect it by either validating alignment, deriving it fromMALLOCX_ALIGN_GET(), or passing known power-of-two constants).New tests fail before the change.