Skip to content

Commit ffdca61

Browse files
authored
Add files via upload
1 parent 74f8145 commit ffdca61

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
| test.cpp:9:8:9:12 | ... * ... | possible signed overflow followed by offset of the pointer out of bounds |
2+
| test.cpp:13:24:13:28 | ... * ... | this transformation is applied after multiplication |
3+
| test.cpp:16:28:16:32 | ... * ... | this transformation is applied after multiplication |
4+
| test.cpp:19:22:19:26 | ... * ... | this transformation is applied after multiplication |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
experimental/Security/CWE/CWE-190/DangerousUseOfTransformationAfterOperation.ql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
void testCall (unsigned long);
2+
void functionWork() {
3+
unsigned long aL;
4+
char aA[10],*aP;
5+
unsigned char aUC;
6+
int aI;
7+
unsigned int aUI;
8+
aI = (aUI*8)/10; // GOOD
9+
aI = aUI*8; // BAD
10+
aP = aA+aI;
11+
aI = (int)aUI*8; // GOOD
12+
13+
aL = (unsigned long)(aI*aI); // BAD
14+
aL = ((unsigned long)aI*aI); // GOOD
15+
16+
testCall((unsigned long)(aI*aI)); // BAD
17+
testCall(((unsigned long)aI*aI)); // GOOD
18+
19+
if((unsigned long)(aI*aI) > aL) // BAD
20+
return;
21+
if(((unsigned long)aI*aI) > aL) // GOOD
22+
return;
23+
}

0 commit comments

Comments
 (0)