-
Notifications
You must be signed in to change notification settings - Fork 274
Fix cbmc crash on pointer checks of void pointer dereferences #5427
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
Fix cbmc crash on pointer checks of void pointer dereferences #5427
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #5427 +/- ##
===========================================
- Coverage 68.21% 66.32% -1.89%
===========================================
Files 1178 1171 -7
Lines 97542 96461 -1081
===========================================
- Hits 66537 63980 -2557
- Misses 31005 32481 +1476
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
auto conditions = address_check(pointer, size_of_expr_opt.value()); | ||
if(expr.type().id() == ID_empty) | ||
{ | ||
size = from_integer(1, size_type()); |
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.
Should we change size_of_expr
to return 1
here instead?
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.
Not sure. There are quite a number of uses in the codebase that check that the return value of size_of_expr()
is not empty, and if it is throw an exception or have some other handling. Probably we should review those at some point, though that's out of scope of this PR.
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.
Is the purpose of this to create an address check that fails?
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.
No the address check should succeed. Basically *p
with p
being a pointer to void is valid as long as p
points to valid memory, though then using the value would be undefined behavior.
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.
Please explain the magic 1
in a comment.
CORE | ||
main.c | ||
--pointer-check | ||
^EXIT=10$ |
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.
- verification failed?
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.
Not necessary I think as EXIT=10
already indicates that cbmc exited without error and verification failed.
auto conditions = address_check(pointer, size_of_expr_opt.value()); | ||
if(expr.type().id() == ID_empty) | ||
{ | ||
size = from_integer(1, size_type()); |
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.
Is the purpose of this to create an address check that fails?
auto conditions = address_check(pointer, size_of_expr_opt.value()); | ||
if(expr.type().id() == ID_empty) | ||
{ | ||
size = from_integer(1, size_type()); |
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.
Please explain the magic 1
in a comment.
41fe04c
to
b8f6483
Compare
Uh oh!
There was an error while loading. Please reload this page.