mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
C++: Support GCC flags making ptr overflow defined
This commit is contained in:
@@ -25,6 +25,11 @@ where
|
|||||||
not exists(MacroInvocation mi |
|
not exists(MacroInvocation mi |
|
||||||
mi.getAnAffectedElement() = add and
|
mi.getAnAffectedElement() = add and
|
||||||
not mi.getMacroName().toLowerCase().matches("%assert%")
|
not mi.getMacroName().toLowerCase().matches("%assert%")
|
||||||
|
) and
|
||||||
|
// There must be a compilation of this file without a flag that makes pointer
|
||||||
|
// overflow well defined.
|
||||||
|
exists(Compilation c | c.getAFileCompiled() = ro.getFile() |
|
||||||
|
not c.getAnArgument() = "-fwrapv-pointer" and
|
||||||
|
not c.getAnArgument() = "-fno-strict-overflow"
|
||||||
)
|
)
|
||||||
// TODO: Add a check for -fno-strict-overflow and -fwrapv-pointer
|
|
||||||
select ro, "Range check relying on pointer overflow."
|
select ro, "Range check relying on pointer overflow."
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
| 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:6:12:6:33 | ... < ... | Range check relying on pointer overflow. |
|
||||||
| test.cpp:33:9:33:21 | ... < ... | Range check relying on pointer overflow. |
|
| test.cpp:33:9:33:21 | ... < ... | Range check relying on pointer overflow. |
|
||||||
|
|||||||
Reference in New Issue
Block a user