Skip to content

Commit 058714b

Browse files
committed
Add regression test for size limit check
This adds a regression test to check that the size limit for arrays is caught and cleanly handled (with appropriate error).
1 parent 1ad790f commit 058714b

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

regression/cbmc/array_too_big/test.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <assert.h>
2+
#include <stdint.h>
3+
#include <stdlib.h>
4+
5+
int main()
6+
{
7+
size_t size;
8+
size = SIZE_MAX;
9+
uint8_t *ptr = malloc(size);
10+
__CPROVER_assume(ptr != NULL);
11+
uint8_t *ptr_end = ptr + size;
12+
assert(ptr <= ptr_end);
13+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
test.c
3+
--pointer-overflow-check --pointer-check
4+
^EXIT=6$
5+
^SIGNAL=0$
6+
^array too large for flattening$
7+
--
8+
^VERIFICATION
9+
--
10+
This test is to check that arrays that are too large are correctly
11+
error handled to prevent exceptions in other parts of the code.

0 commit comments

Comments
 (0)