Skip to content

Commit 9c3cf67

Browse files
committed
Add regtests to distinguish between ptr value and deref bounds
1 parent 08f01ee commit 9c3cf67

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// PARAM: --set ana.activated[+] memOutOfBounds --enable ana.int.interval
2+
#include <stdlib.h>
3+
#include <stdio.h>
4+
5+
int main(void) {
6+
char *buf = malloc(4);
7+
char *end;
8+
end = buf + 4; //NOWARN
9+
printf("%p", (void *) end); //NOWARN
10+
free(buf);
11+
return 0;
12+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// PARAM: --set ana.activated[+] memOutOfBounds --enable ana.int.interval
2+
#include <stdlib.h>
3+
4+
struct S {
5+
unsigned char a;
6+
unsigned char b:2;
7+
unsigned char c:2;
8+
unsigned char d;
9+
} __attribute__((packed));
10+
11+
int main(void) {
12+
struct S *p = malloc(2);
13+
p->d = 1; //WARN
14+
free(p);
15+
return 0;
16+
}

0 commit comments

Comments
 (0)