Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3aafcf4 commit 0df3d2cCopy full SHA for 0df3d2c
1 file changed
cpp/ql/test/query-tests/Likely Bugs/Memory Management/PointerOverflowCheck/test.cpp
@@ -9,7 +9,7 @@ bool check_pointer_overflow(P *ptr, P *ptr_end) {
9
// x86-64 gcc 9.2 -O2: not deleted
10
// x86-64 clang 9.0.0 -O2: not deleted
11
// x64 msvc v19.22 /O2: not deleted
12
- return ptr + 4 >= ptr_end; // GOOD
+ return ptr_end - ptr > 4; // GOOD
13
}
14
15
struct Q {
@@ -22,6 +22,6 @@ struct Q {
22
void foo(int untrusted_int) {
23
Q q;
24
if (q.begin() + untrusted_int > q.end() || // GOOD
25
- q.begin() + untrusted_int < q.begin()) // BAD
+ q.begin() + untrusted_int < q.begin()) // BAD [NOT DETECTED]
26
throw q;
27
0 commit comments