Skip to content
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

Fixed crash caused by invalid id in value set #1514

Merged
merged 2 commits into from
Nov 25, 2023

Conversation

XLiZHI
Copy link
Collaborator

@XLiZHI XLiZHI commented Nov 21, 2023

ESBMC should not crash for program.

typedef struct {
  int a;
} b;

int main()
{
  ((b *)60000)->a = 0;
}

For some code that directly manipulated memory, this would cause our static analysis module to crash.

@fbrausse fbrausse self-requested a review November 21, 2023 16:54
@@ -1288,7 +1288,7 @@ void value_sett::assign_rec(
else if(
is_constant_string2t(lhs) || is_null_object2t(lhs) ||
is_valid_object2t(lhs) || is_deallocated_obj2t(lhs) ||
is_dynamic_size2t(lhs) || is_constant_array2t(lhs))
is_dynamic_size2t(lhs) || is_constant_array2t(lhs) || is_invalid2t(lhs))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This check should be done where the invalid2t expression is obtained originally in the recursion: in the is_dereference2t(lhs) branch. The reason is that when possible we should handle the "special" value-set expressions unknown2t, invalid2t, etc. together, such that it's clear that assign_rec() itself only handles the non-special ones; i.e., the special should not escape.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see, thank you!

Copy link
Collaborator

@fbrausse fbrausse left a comment

Choose a reason for hiding this comment

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

Thank you @XLiZHI, LGTM.

Copy link
Contributor

@lucasccordeiro lucasccordeiro left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this PR, @XLiZHI.

@lucasccordeiro lucasccordeiro merged commit dd2ba38 into esbmc:master Nov 25, 2023
8 checks passed
@XLiZHI XLiZHI deleted the static branch January 21, 2024 07:42
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.

3 participants