Skip to content

Fix array length in symex constant string propagation [TG-9048] #5040

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
merged 3 commits into from
Aug 20, 2019

Conversation

romainbrenguier
Copy link
Contributor

This adds an assumption on the length in assign_string_constant before we do the actual assignment. This is to make sure that the length of the array before the assignment
isn't unconstrained. Otherwise this array could be set to be arbitrarily large
by the solver which would cause invalid traces.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • [na] The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • [na] My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • [na] White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@romainbrenguier romainbrenguier requested a review from danpoe August 20, 2019 12:52
@romainbrenguier romainbrenguier changed the title Fix array length in symex constant string propagation Fix array length in symex constant string propagation [TG-9048] Aug 20, 2019
@@ -590,6 +590,9 @@ class goto_symext
/// "abc", the symbol will be named "abc_constant_char_array"). Then, the
/// expression `&sym[0]` is assigned to `char_array` (assuming `sym` denotes
/// the symbol holding the string data given by `new_char_array`.
/// The assignment is preceeded by a assume statements ensuring `length`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"a assume statements" -> "an assume statement"

@@ -590,6 +590,9 @@ class goto_symext
/// "abc", the symbol will be named "abc_constant_char_array"). Then, the
/// expression `&sym[0]` is assigned to `char_array` (assuming `sym` denotes
/// the symbol holding the string data given by `new_char_array`.
/// The assignment is preceeded by a assume statements ensuring `length`
/// before this call was zero, this is to avoid letting the previous array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"letting the previous array unconstrained" -> "letting the previous array be unconstrained" or "leaving the previous array unconstrained"

--
^warning: ignoring
--
The check for dynamic_object2 is to make sure the array is created empty and
is not given arbitrary content before its final assignment.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline

This is to make sure that the length of the array before the assignment
isn't unconstrained. Otherwise it could be set to be arbitrarily large
by the solver which will causes invalid traces.
Split the tests for the different constructors, add assertions that
are supposed to fail, and activate the tests that can be.
This tests would fail before the fix to the symex constant propagation
of strings.
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.

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: e03ca3d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/123901901
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

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: 334714a).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/123906978

@romainbrenguier romainbrenguier merged commit 04aa83e into develop Aug 20, 2019
@romainbrenguier romainbrenguier deleted the bugfix/empty-string-propagation branch August 20, 2019 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants