mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
24 lines
643 B
Plaintext
24 lines
643 B
Plaintext
import cpp
|
|
import semmle.code.cpp.rangeanalysis.new.SimpleRangeAnalysis
|
|
import utils.test.InlineExpectationsTest
|
|
|
|
module RangeAnalysisTest implements TestSig {
|
|
string getARelevantTag() { result = "overflow" }
|
|
|
|
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)
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
import MakeTest<RangeAnalysisTest>
|