Add __builtion_unreachable to vector::size(), vector::capacity()
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / taint-alloc-3.c
blob34bae28ac6aa14e768223a77e6572cf5e7e55cf5
1 /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
3 #include "analyzer-decls.h"
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
8 /* malloc with tainted size from a syscall. */
10 void *p;
12 void __attribute__((tainted_args))
13 test_1 (size_t sz) /* { dg-message "\\(1\\) function 'test_1' marked with '__attribute__\\(\\(tainted_args\\)\\)'" } */
15 /* TODO: should have a message saying why "sz" is tainted, e.g.
16 "treating 'sz' as attacker-controlled because 'test_1' is marked with '__attribute__((tainted_args))'" */
18 p = malloc (sz); /* { dg-warning "use of attacker-controlled value 'sz' as allocation size without upper-bounds checking" "warning" } */
19 /* { dg-message "\\(\[0-9\]+\\) use of attacker-controlled value 'sz' as allocation size without upper-bounds checking" "final event" { target *-*-* } .-1 } */