Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

kroening
Copy link
Member

No description provided.

Copy link
Collaborator

@tautschnig tautschnig left a 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)
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Collaborator

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).

@tautschnig
Copy link
Collaborator

After some further discussion with @polgreen: in the same way that void pointers are skipped, so should be function pointers.

@kroening
Copy link
Member Author

Indeed, done.

Copy link
Contributor

@allredj allredj left a 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

@NlightNFotis
Copy link
Contributor

Hi @kroening, is this PR still relevant? If yes, can we get it rebased on develop? If not, can we get it closed?

@TGWDB
Copy link
Contributor

TGWDB commented May 3, 2023

Closing due to age (no further comment on PR content), please reopen with rebase on develop if you intent to continue this work.

@TGWDB TGWDB closed this May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants