Skip to content

Commit

Permalink
Add test case with invalid deref in complex loop
Browse files Browse the repository at this point in the history
  • Loading branch information
mrstanb committed Oct 3, 2023
1 parent fb4ad24 commit 9d64db1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/regression/77-mem-oob/10-oob-two-loops.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// PARAM: --set ana.activated[+] memOutOfBounds --enable ana.int.interval
int main() {
int *p = malloc(1048 * sizeof(int));

for (int i = 0; i < 1048; ++i) {
p[i] = __VERIFIER_nondet_int(); //NOWARN
}

int *q = p;

while (*q >= 0 && q < p + 1048 * sizeof(int)) { //WARN
if (__VERIFIER_nondet_int()) {
q++;
} else {
(*q)--; //WARN
}
}
free(p);
return 0;
}

0 comments on commit 9d64db1

Please sign in to comment.