File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
cpp/ql/test/experimental/query-tests/Security/CWE/CWE-190/IfStatementAdditionOverflow Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,12 @@ void test()
8
8
int a = getAnInt ();
9
9
int b = getAnInt ();
10
10
int c = getAnInt ();
11
- int x = getAnInt ();
11
+ int x = getAnInt ();
12
12
int y = getAnInt ();
13
- int d = getADouble ();
14
- int a1 = getAnUnsignedShort ();
15
- int b1 = getAnUnsignedShort ();
16
- int c1 = getAnUnsignedShort ();
13
+ double d = getADouble ();
14
+ unsigned short a1 = getAnUnsignedShort ();
15
+ unsigned short b1 = getAnUnsignedShort ();
16
+ unsigned short c1 = getAnUnsignedShort ();
17
17
18
18
if (a+b>c) a = c-b; // BAD
19
19
if (a+b>c) { a = c-b; } // BAD
@@ -51,7 +51,7 @@ void test()
51
51
if (c<=b+a) a = c-b; // BAD
52
52
if (c<=b+a) { a = c-b; } // BAD
53
53
54
- if (a+b>d) a = d-b; // GOOD
54
+ if (a+b>d) a = d-b; // BAD
55
55
if (a+(-x)>c) a = c-(-y); // GOOD
56
56
if (a+b>c) { b++; a = c-b; } // GOOD
57
57
if (a+d>c) a = c-d; // GOOD
You can’t perform that action at this time.
0 commit comments