Improve memOutOfBounds precision for points-to sets which mix allocs with others#2030
Improve memOutOfBounds precision for points-to sets which mix allocs with others#2030sim642 wants to merge 2 commits into
Conversation
Pointer may point to either allocated blob or static array. Currently memOutOfBounds only uses BlobSize query for points-to sets which are definitely alloc, but not a mix.
|
According to an sv-benchmarks run with level01, 60s and 1GB, this doesn't improve any verdicts: https://goblint.cs.ut.ee/results/335-all-level01-pr-2030-after/table-generator-cmp.diff.html#/table. However, there is a regression on
where Somehow it's coming from the EDIT: These are fixed by #2035. |
There was a problem hiding this comment.
Pull request overview
This PR improves size reasoning for out-of-bounds checks when a pointer may target both allocated memory and non-allocated objects, moving toward per-pointee size handling.
Changes:
- Refactors pointer target size computation in
memOutOfBoundsandbaseto inspect individual points-to elements. - Adds a regression test for a pointer that may refer to either a malloc allocation or a static array.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/analyses/memOutOfBounds.ml |
Updates target-size computation for mixed points-to sets. |
src/analyses/base.ml |
Applies analogous target-size handling for memory-copy modeling. |
tests/regression/74-invalid_deref/38-oob-alloc-array-mix.c |
Adds regression coverage for alloc/static-array mixed points-to sets. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| (* Ask for BlobSize from the base address (the second component being set to true) in order to avoid BlobSize giving us bot *) | ||
| man.ask (Queries.BlobSize {exp = ptr; base_address = true}) |
| (* Ask for BlobSize from the base address (the second component being set to true) in order to avoid BlobSize giving us bot *) | ||
| man.ask (Queries.BlobSize {exp = ptr; base_address = true}) |
This is on top of #2029.
Pointer may point to either allocated blob or static array.
Currently memOutOfBounds only uses
BlobSizequery for points-to sets which are definitely alloc, but not a mix.This moves the decision to be made per-pointee basis, not on the basis of the whole points-to set.
The diff probably looks much nicer with whitespace ignored.
TODO
TopValueexceptions from sv-benchmarks.