Repository navigation
Macro census and every-definition self-sized destinations - #187
Merged
Merged
Conversation
…destination to be sized, and resolve header members, constants and qualified class names
prabhu
force-pushed
the
feat/memsafe-part13
branch
from
September 28, 2026 02:49
a167a78 to
a06ab01
Compare
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.
Consolidates
feat/memsafe-part13-selfsizedandfeat/macro-census, with fixes from an adversarial review of both.MS-BOUND-002 self-sized destinations. The rule now stays silent only when every value the destination can hold is safe: an allocation sized from the copy length, or a fixed array that an enclosing
ifbounds by its ownsizeof. The check also:+=,++and similar;need = n + 8to be unsigned and summed in a wider type, so it can't wrap;strndup,strncat, andcallocwith a variable count;av_grow_packet, and*len -= kin-place strips.Macro census. Opt-in
--macro-census <file>and--auto-definesfind build-config macros that hide#ifcode, and define the ones with strong evidence (template-declared switches,CONFIG_*/ENABLE_*). Compared with the earlier branch, it:#elifdef, and comments inside directives;--macro-filesor--include-files, and skips its own report;A bare
--define Xnow meansX=1, as with gcc. The AST cache key now includes the contents of macro and include files.Results:
--auto-defines. No fixed-tree hits.dbformat.cc:129, needs a helper-return summary) and one per FFmpeg tree (rtpdec_h264.c:282, needs correlated conditions).Known limits:
GuardPass.holdsAtgets the condition backwards after anifwhose else exits. The guard check here avoids it by requiring the assignment inside theif.