Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 463bf96

Browse files
committed
C++: Test showing FP with -fno-strict-overflow
1 parent 8ed9917 commit 463bf96

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
| no_strict_overflow.c:5:9:5:21 | ... < ... | Range check relying on pointer overflow. |
12
| test.cpp:6:12:6:33 | ... < ... | Range check relying on pointer overflow. |
23
| test.cpp:33:9:33:21 | ... < ... | Range check relying on pointer overflow. |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// semmle-extractor-options: -fno-strict-overflow
2+
3+
int not_in_range_nostrict(int *ptr, int *ptr_end, unsigned int a) {
4+
return ptr + a < ptr_end || // GOOD (for the purpose of this test)
5+
ptr + a < ptr; // GOOD (due to compiler options) [FALSE POSITIVE]
6+
}

0 commit comments

Comments
 (0)