Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0638b51

Browse files
committed
C++: Support custom range expression modeling for variable accesses
1 parent b4929db commit 0638b51

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,9 @@ private float getLowerBoundsImpl(Expr expr) {
720720
or
721721
// Use SSA to get the lower bounds for a variable use.
722722
exists(RangeSsaDefinition def, StackVariable v | expr = def.getAUse(v) |
723-
result = getDefLowerBounds(def, v)
723+
result = getDefLowerBounds(def, v) and
724+
// Not explicitly modeled by a RangeAnalysisExpr
725+
not expr instanceof RangeAnalysisExpr
724726
)
725727
or
726728
// unsigned `&` (tighter bounds may exist)
@@ -893,7 +895,9 @@ private float getUpperBoundsImpl(Expr expr) {
893895
or
894896
// Use SSA to get the upper bounds for a variable use.
895897
exists(RangeSsaDefinition def, StackVariable v | expr = def.getAUse(v) |
896-
result = getDefUpperBounds(def, v)
898+
result = getDefUpperBounds(def, v) and
899+
// Not explicitly modeled by a RangeAnalysisExpr
900+
not expr instanceof RangeAnalysisExpr
897901
)
898902
or
899903
// unsigned `&` (tighter bounds may exist)

0 commit comments

Comments
 (0)