Skip to content

Commit 10cc574

Browse files
authored
Add files via upload
1 parent 01c13c4 commit 10cc574

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
| test.cpp:10:3:10:10 | ... = ... | this expression needs attention |
2+
| test.cpp:12:3:12:6 | ... ++ | this expression needs attention |
3+
| test.cpp:13:3:13:6 | ++ ... | this expression needs attention |
4+
| test.cpp:14:6:14:21 | ... = ... | this expression needs attention |
5+
| test.cpp:16:6:16:21 | ... = ... | this expression needs attention |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
experimental/Security/CWE/CWE-783/OperatorPrecedenceLogicErrorWhenUseBoolType.ql
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
int tmpFunc()
2+
{
3+
return 12;
4+
}
5+
void testFunction()
6+
{
7+
int i1,i2,i3;
8+
bool b1,b2,b3;
9+
char c1,c2,c3;
10+
b1 = -b2; //BAD
11+
b1 = !b2; //GOOD
12+
b1++; //BAD
13+
++b1; //BAD
14+
if(i1=tmpFunc()!=i2) //BAD
15+
return;
16+
if(i1=tmpFunc()!=11) //BAD
17+
return;
18+
if((i1=tmpFunc())!=i2) //GOOD
19+
return;
20+
if((i1=tmpFunc())!=11) //GOOD
21+
return;
22+
if(i1=tmpFunc()!=1) //GOOD
23+
return;
24+
if(i1=tmpFunc()==b1) //GOOD
25+
return;
26+
}

0 commit comments

Comments
 (0)