Merge pull request #5877 from MathiasVP/detect-more-abs-in-overflow-library

C++: Detect more uses of `abs`
This commit is contained in:
Geoffrey White
2021-05-12 10:02:12 +01:00
committed by GitHub
3 changed files with 25 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ import semmle.code.cpp.rangeanalysis.RangeAnalysisUtils
* Holds if the value of `use` is guarded using `abs`.
*/
predicate guardedAbs(Operation e, Expr use) {
exists(FunctionCall fc | fc.getTarget().getName() = "abs" |
exists(FunctionCall fc | fc.getTarget().getName() = ["abs", "labs", "llabs", "imaxabs"] |
fc.getArgument(0).getAChild*() = use and
guardedLesser(e, fc)
)