Skip to content

Commit bf84f3a

Browse files
committed
C++: Add FN.
1 parent 3295d5c commit bf84f3a

File tree

1 file changed

+21
-1
lines changed
  • cpp/ql/test/query-tests/Security/CWE/CWE-843

1 file changed

+21
-1
lines changed

cpp/ql/test/query-tests/Security/CWE/CWE-843/test.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,24 @@ void test15() {
189189
UInt8_with_more* u8 = (UInt8_with_more*)u64; // BAD
190190
}
191191

192-
// semmle-extractor-options: --gcc -std=c++11
192+
struct SingleInt {
193+
int i;
194+
} __attribute__((packed));;
195+
196+
struct PairInts {
197+
int x, y;
198+
} __attribute__((packed));;
199+
200+
union MyUnion
201+
{
202+
PairInts p;
203+
unsigned long long foo;
204+
} __attribute__((packed));
205+
206+
void test16() {
207+
void* si = new SingleInt;
208+
// ...
209+
MyUnion* mu = (MyUnion*)si; // BAD [NOT DETECTED]
210+
}
211+
212+
// semmle-extractor-options: --gcc -std=c++11

0 commit comments

Comments
 (0)