Skip to content

Commit 2477c3a

Browse files
authored
Update test.cpp
1 parent 91a9a7e commit 2477c3a

File tree

1 file changed

+6
-6
lines changed
  • cpp/ql/test/experimental/query-tests/Security/CWE/CWE-190/IfStatementAdditionOverflow

1 file changed

+6
-6
lines changed

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-190/IfStatementAdditionOverflow/test.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ void test()
88
int a = getAnInt();
99
int b = getAnInt();
1010
int c = getAnInt();
11-
int x = getAnInt();
11+
int x = getAnInt();
1212
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();
1717

1818
if (a+b>c) a = c-b; // BAD
1919
if (a+b>c) { a = c-b; } // BAD
@@ -51,7 +51,7 @@ void test()
5151
if (c<=b+a) a = c-b; // BAD
5252
if (c<=b+a) { a = c-b; } // BAD
5353

54-
if (a+b>d) a = d-b; // GOOD
54+
if (a+b>d) a = d-b; // BAD
5555
if (a+(-x)>c) a = c-(-y); // GOOD
5656
if (a+b>c) { b++; a = c-b; } // GOOD
5757
if (a+d>c) a = c-d; // GOOD

0 commit comments

Comments
 (0)