Improve memOutOfBounds precision by querying size/length of particular variable#2057
Merged
Conversation
… of particular variable
The only true instance now queries a variable without offset. So argument can be considered implicitly false.
06643c8 to
e6b53bc
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the memOutOfBounds precision improvements by making size/length queries target a specific base variable (rather than querying over a mixed points-to set), and simplifies the BlobSize query API accordingly.
Changes:
- Simplify
Queries.BlobSizefrom a{exp; base_address}record parameter to justexp. - Update the base analysis’
BlobSizequery implementation to require base (no-offset) addresses and to cast blob sizes toptrdifffor downstream arithmetic. - Update
memOutOfBoundsand base’s pointer-target sizing helpers to queryBlobSize/EvalLengthonAddrOf (Var v, NoOffset).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/domains/queries.ml | Changes the BlobSize query type and related compare/hash/pretty logic. |
| src/analyses/memOutOfBounds.ml | Queries blob size/array length using a base-address expression per pointee to improve precision. |
| src/analyses/base.ml | Adjusts BlobSize query handling (offset handling + casting) and updates callers to use base-address queries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
On sv-benchmarks with level02 and 90s, this makes no difference to verdicts. |
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 is a continuation of #2030.
It is necessary to make the analysis relational between the address base size and the offset (PR to come) but already on its own reveals some issues.