File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed
cpp/ql/src/semmle/code/cpp/ir/dataflow Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -4,25 +4,17 @@ private import semmle.code.cpp.ir.dataflow.DataFlow
44private import semmle.code.cpp.ir.IR
55
66/**
7- * A predictable expression is one where an external user can predict
7+ * A predictable instruction is one where an external user can predict
88 * the value. For example, a literal in the source code is considered
99 * predictable.
1010 */
11- // TODO: Change to use Instruction instead of Expr. Naive attempt breaks
12- // TaintedAllocationSize qltest.
13- private predicate predictable ( Expr expr ) {
14- expr instanceof Literal
11+ private predicate predictableInstruction ( Instruction instr ) {
12+ instr instanceof ConstantInstruction
1513 or
16- exists ( BinaryOperation binop | binop = expr |
17- predictable ( binop .getLeftOperand ( ) ) and predictable ( binop .getRightOperand ( ) )
18- )
14+ instr instanceof StringConstantInstruction
1915 or
20- exists ( UnaryOperation unop | unop = expr | predictable ( unop .getOperand ( ) ) )
21- }
22-
23- // TODO: remove when `predictable` has an `Instruction` parameter instead of `Expr`.
24- private predicate predictableInstruction ( Instruction instr ) {
25- predictable ( DataFlow:: instructionNode ( instr ) .asExpr ( ) )
16+ // This could be a conversion on a string literal
17+ predictableInstruction ( instr .( UnaryInstruction ) .getUnary ( ) )
2618}
2719
2820private class DefaultTaintTrackingCfg extends DataFlow:: Configuration {
You can’t perform that action at this time.
0 commit comments