-
Notifications
You must be signed in to change notification settings - Fork 273
SSS: value-set-analysis adaptation #612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSS: value-set-analysis adaptation #612
Conversation
Encountered during security scanner analysis: a potential case where an infinite series of pointer casts (both explicit and implicit via taking the address of a structure's first member) was accumulated, leading to nontermintion of the VSA algorithm. This is a temporary fix until the underlying cause can be conclusively identified.
Value sets already know their own location id; this adds the function id too so that context-sensitive variants of VSA can find that without needing to track extra context themselves.
This is essentially specific to the security scanner's needs, but is also impossible to add to value-set without templating the class, thus moving ~2000LOC into its header file. This is the temporary kludge until we bite the bullet and do that, or think of something smarter.
This templates value-set-analysis, so that it can be subclassed providing a value-set extension, and virtualizes value-set so it can similarly be extended.
src/pointer-analysis/value_set.cpp
Outdated
@@ -1062,6 +1062,32 @@ void value_sett::get_reference_set( | |||
dest.push_back(to_expr(it)); | |||
} | |||
|
|||
static void strip_casts( | |||
exprt& e, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&
cfc2ba4
to
ff34029
Compare
Done |
src/pointer-analysis/value_set.cpp
Outdated
@@ -1062,6 +1062,32 @@ void value_sett::get_reference_set( | |||
dest.push_back(to_expr(it)); | |||
} | |||
|
|||
static void strip_casts( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function comment block missing
return; | ||
} | ||
else | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a blank line after the return
xmlt &i=dest.new_element("instruction"); | ||
i.new_element()=::xml(location); | ||
|
||
for(value_sett::valuest::const_iterator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for each
if(location==previous_location) | ||
continue; | ||
|
||
if(location.is_nil() || location.get_file()==irep_idt()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_file().empty()
No functional changes
Made first two changes. The latter two are inherited from existing VSA, so I won't make them here (they will only clash with likely-upcoming upstream changes) |
Fixed: Bug in String.indexOf() #612
This makes a couple of small additions to VSA (storing function-ID in each value set, and a declared-type in value set entries), and templatizes and virtualizes it to make it suitable for subclassing and adaptation by the security scanner.