Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr111266.c

raw
1 #include <stdint.h>
2 void *malloc (__SIZE_TYPE__);
3 void free (void *);
4
5 void test_binop2 ()
6 {
7 char *p = (char *) malloc (4);
8 int32_t *i = (int32_t *) (p + 3);
9 *i = 20042; /* { dg-warning "heap-based buffer overflow" } */
10 free (p);
11 }