Skip to content

Security scanner support #845

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

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix pointer-invalidation bug in ansi-c/padding.cpp
The insert on line 262 invalidates the iterators of the vector which is
being iterated, which may cause the reference on line 206 to dangle.
This in turn leads to undefined behaviour on line 269 when the reference
is passed to a function.

The fix is to take a copy instead of a reference on line 206.
  • Loading branch information
reuk committed Apr 16, 2017
commit feb1108807f72b17a57b3665188e7312a07c7827
2 changes: 1 addition & 1 deletion src/ansi-c/padding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void add_padding(struct_typet &type, const namespacet &ns)
it!=components.end();
it++)
{
const typet &it_type=it->type();
const typet it_type=it->type();
mp_integer a=1;

const bool packed=it_type.get_bool(ID_C_packed) ||
Expand Down