-
Notifications
You must be signed in to change notification settings - Fork 274
do not attempt to havoc void-typed objects; fixes issue #2663 #2735
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
Conversation
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.
See below; also lacks tests and I am not sure the commit message would make GitHub automatically close the issue.
@@ -271,7 +271,8 @@ class havoc_generate_function_bodiest : public generate_function_bodiest, | |||
if( | |||
parameter.type().id() == ID_pointer && | |||
std::regex_match( | |||
id2string(parameter.get_base_name()), parameters_to_havoc)) | |||
id2string(parameter.get_base_name()), parameters_to_havoc) && | |||
parameter.type().subtype().id() != ID_empty) |
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.
I think this should instead fall back to char
, doing whatever would happen if the parameter were of type char*
. Leaving the pointed-to object unmodified may fail to meet the user's expectations.
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.
I'd say that the user's expectation will be that the entire object that the 'void *' points to gets havoc'ed. 'char' seems arbitrary.
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.
So should we just refuse to generate code? Most cases using void *
as parameter type will accept more than a single object type (e.g., arrays of varying length).
After some further discussion with @polgreen: in the same way that void pointers are skipped, so should be function pointers. |
c8642dc
to
7c4a98a
Compare
Indeed, done. |
7c4a98a
to
d02cf30
Compare
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.
Passed Diffblue compatibility checks (cbmc commit: d02cf30).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/85620044
Hi @kroening, is this PR still relevant? If yes, can we get it rebased on |
Closing due to age (no further comment on PR content), please reopen with rebase on develop if you intent to continue this work. |
No description provided.