File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
regression/cbmc-library/calloc-02 Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
1
#include <assert.h>
2
+ #include <stdint.h>
2
3
#include <stdlib.h>
3
4
4
5
int main ()
@@ -7,6 +8,10 @@ int main()
7
8
if (p )
8
9
assert (p [0 ] == 0 );
9
10
11
+ p = calloc (SIZE_MAX , 1 );
12
+ if (p )
13
+ assert (p [0 ] == 0 );
14
+
10
15
size_t size ;
11
16
size_t num ;
12
17
p = calloc (size , num );
Original file line number Diff line number Diff line change 1
1
CORE
2
2
main.c
3
- --unsigned-overflow-check --pointer-check
3
+ --unsigned-overflow-check --pointer-check --arrays-uf-always
4
4
^EXIT=0$
5
5
^SIGNAL=0$
6
6
^VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change 13
13
14
14
#include " arith_tools.h"
15
15
#include " c_types.h"
16
+ #include " magic.h"
16
17
#include " namespace.h"
17
18
#include " pointer_offset_size.h"
18
19
#include " std_code.h"
@@ -133,7 +134,9 @@ optionalt<exprt> expr_initializert<nondet>::expr_initializer_rec(
133
134
return {};
134
135
135
136
const auto array_size = numeric_cast<mp_integer>(array_type.size ());
136
- if (array_type.size ().id () == ID_infinity || !array_size.has_value ())
137
+ if (
138
+ array_type.size ().id () == ID_infinity || !array_size.has_value () ||
139
+ *array_size > MAX_FLATTENED_ARRAY_SIZE)
137
140
{
138
141
if (nondet)
139
142
return side_effect_expr_nondett (type, source_location);
You can’t perform that action at this time.
0 commit comments