Lines Matching +full:array +full:- +full:bounds
1 // RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-checker=core,alpha.security.ArrayBoundV2 -v…
3 // Tests doing an out-of-bounds access after the end of an array using:
4 // - constant integer index
5 // - constant integer size for buffer
8 buf[100] = 1; // expected-warning{{Out of bound memory access}} in test1()
13 buf[99] = 1; // no-warning in test1_ok()
18 return mystr[-1]; // expected-warning{{Out of bound memory access}} in test1_strings_underrun()
23 return mystr[1000]; // expected-warning{{Out of bound memory access}} in test1_strings_overrun()
28 return mystr[5]; // no-warning in test1_strings_ok()
31 // Tests doing an out-of-bounds access after the end of an array using:
32 // - indirect pointer to buffer
33 // - constant integer index
34 // - constant integer size for buffer
38 p[101] = 1; // expected-warning{{Out of bound memory access}} in test1_ptr()
44 p[99] = 1; // no-warning in test1_ptr_ok()
47 // Tests doing an out-of-bounds access before the start of an array using:
48 // - indirect pointer to buffer, manipulated using simple pointer arithmetic
49 // - constant integer index
50 // - constant integer size for buffer
55 p[0] = 1; // expected-warning{{Out of bound memory access}} in test1_ptr_arith()
62 p[0] = 1; // no-warning in test1_ptr_arith_ok()
69 p[1] = 1; // expected-warning{{Out of bound memory access}} in test1_ptr_arith_bad()
76 p[-1] = 1; // no-warning in test1_ptr_arith_ok2()
79 // Tests doing an out-of-bounds access before the start of an array using:
80 // - constant integer index
81 // - constant integer size for buffer
84 buf[-1] = 1; // expected-warning{{Out of bound memory access}} in test2()
87 // Tests doing an out-of-bounds access before the start of an array using:
88 // - indirect pointer to buffer
89 // - constant integer index
90 // - constant integer size for buffer
94 p[-1] = 1; // expected-warning{{Out of bound memory access}} in test2_ptr()
97 // Tests doing an out-of-bounds access before the start of an array using:
98 // - indirect pointer to buffer, manipulated using simple pointer arithmetic
99 // - constant integer index
100 // - constant integer size for buffer
104 --p; in test2_ptr_arith()
105 …p[0] = 1; // expected-warning {{Out of bound memory access (accessed memory precedes memory block)… in test2_ptr_arith()
108 // Tests doing an out-of-bounds access before the start of a multi-dimensional
109 // array using:
110 // - constant integer indices
111 // - constant integer sizes for the array
114 buf[0][-1] = 1; // expected-warning{{Out of bound memory access}} in test2_multi()
117 // Tests doing an out-of-bounds access before the start of a multi-dimensional
118 // array using:
119 // - constant integer indices
120 // - constant integer sizes for the array
123 buf[-1][0] = 1; // expected-warning{{Out of bound memory access}} in test2_multi_b()
128 buf[0][0] = 1; // no-warning in test2_multi_ok()
154 buf[-1] = 0; // no-warning; in test_index_below_symboloc()
160 p[1] = 42; // no-warning in test_incomplete_struct()
166 p[1] = 42; // no-warning in test_extern_void()