Files
codeql/cpp/ql/test/library-tests/ir/range-analysis/Overflow.ql
Robert Marsh 18c3feb9d8 C++: remove commented-out code
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
2023-04-11 10:41:18 -04:00

24 lines
693 B
Plaintext

import cpp
import semmle.code.cpp.rangeanalysis.new.SimpleRangeAnalysis
import TestUtilities.InlineExpectationsTest
class RangeAnalysisTest extends InlineExpectationsTest {
RangeAnalysisTest() { this = "RangeAnalysisTest" }
override string getARelevantTag() { result = "overflow" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(Expr e |
tag = "overflow" and
element = e.toString() and
location = e.getLocation() and
value =
strictconcat(string s |
s = "+" and exprMightOverflowPositively(e)
or
s = "-" and exprMightOverflowNegatively(e)
)
)
}
}