Skip to content

symex_allocate: only use alloc_size when set #4242

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 1 commit into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions regression/cbmc/Malloc25/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdlib.h>

int main(int argc, char *argv[])
{
int *p = malloc((size_t)argc * (size_t)argc * sizeof(int));
return 0;
}
8 changes: 8 additions & 0 deletions regression/cbmc/Malloc25/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
2 changes: 1 addition & 1 deletion src/goto-symex/symex_builtin_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void goto_symext::symex_allocate(

object_type = array_typet(*tmp_type, s);
}
else
else if(alloc_size.has_value())
{
if(*alloc_size == *elem_size)
object_type = *tmp_type;
Expand Down