mirror of
https://github.com/github/codeql.git
synced 2026-05-04 13:15:21 +02:00
C++: Test of range analysis 64-bit rounding issue
This commit is contained in:
@@ -32,4 +32,5 @@
|
||||
| PointlessComparison.c:129:12:129:16 | ... > ... | Comparison is always false because a <= 3. |
|
||||
| PointlessComparison.c:197:7:197:11 | ... < ... | Comparison is always false because x >= 0. |
|
||||
| RegressionTests.cpp:57:7:57:22 | ... <= ... | Comparison is always true because * ... <= 4294967295. |
|
||||
| RegressionTests.cpp:63:7:63:17 | ... == ... | Comparison is always false because ... + ... >= 1. |
|
||||
| Templates.cpp:9:10:9:24 | ... <= ... | Comparison is always true because local <= 32767. |
|
||||
|
||||
@@ -57,3 +57,12 @@ static int foo(size_t *size)
|
||||
if (*size <= MAX_VAL) // BAD (pointless comparison) [NO LONGER REPORTED]
|
||||
*size = MAX_VAL;
|
||||
}
|
||||
|
||||
// ODASA-7205
|
||||
int regression_test_01(unsigned long bb) {
|
||||
if (bb + 1 == 0) { // GOOD [FALSE POSITIVE]
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user