mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C++: Test showing FP with -fno-strict-overflow
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
| no_strict_overflow.c:5:9:5:21 | ... < ... | Range check relying on pointer overflow. |
|
||||
| test.cpp:6:12:6:33 | ... < ... | Range check relying on pointer overflow. |
|
||||
| test.cpp:33:9:33:21 | ... < ... | Range check relying on pointer overflow. |
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// semmle-extractor-options: -fno-strict-overflow
|
||||
|
||||
int not_in_range_nostrict(int *ptr, int *ptr_end, unsigned int a) {
|
||||
return ptr + a < ptr_end || // GOOD (for the purpose of this test)
|
||||
ptr + a < ptr; // GOOD (due to compiler options) [FALSE POSITIVE]
|
||||
}
|
||||
Reference in New Issue
Block a user