Skip to content

Commit f5ec231

Browse files
committed
C++: Add a FP from DCA.
1 parent 0fb27fb commit f5ec231

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

cpp/ql/test/query-tests/Security/CWE/CWE-191/UnsignedDifferenceExpressionComparedZero/UnsignedDifferenceExpressionComparedZero.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
| test.cpp:276:11:276:19 | ... > ... | Unsigned subtraction can never be negative. |
1515
| test.cpp:288:10:288:18 | ... > ... | Unsigned subtraction can never be negative. |
1616
| test.cpp:312:9:312:25 | ... > ... | Unsigned subtraction can never be negative. |
17+
| test.cpp:335:6:335:18 | ... > ... | Unsigned subtraction can never be negative. |

cpp/ql/test/query-tests/Security/CWE/CWE-191/UnsignedDifferenceExpressionComparedZero/test.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,3 +321,18 @@ void test19() {
321321
total += get_data();
322322
}
323323
}
324+
325+
void test20(int a, bool b, unsigned long c)
326+
{
327+
int x = 0;
328+
329+
if(b) {
330+
x = (a - c) / 2;
331+
} else {
332+
x = a - c;
333+
}
334+
335+
if (a - c - x > 0) // GOOD [FALSE POSITIVE]
336+
{
337+
}
338+
}

0 commit comments

Comments
 (0)