Skip to content

Commit c831c4b

Browse files
committed
C++ IR: Fix SignAnalysis after getAnyDef -> getDef
In the `SignAnalysis` abstract interpretation, "unknown sign" corresponds to the set of _all_ `Sign`, but using `getDef` leads to the operand having _no_ `Sign`. To fix that, we assign all signs to inexact operands.
1 parent 52cfbff commit c831c4b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cpp/ql/src/semmle/code/cpp/rangeanalysis/SignAnalysis.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,9 @@ cached module SignAnalysisCached {
368368
or
369369
result = guardedOperandSign(operand) and
370370
result = guardedOperandSignOk(operand)
371+
or
372+
// `result` is unconstrained if the definition is inexact. Then any sign is possible.
373+
operand.isDefinitionInexact()
371374
}
372375

373376
cached

0 commit comments

Comments
 (0)