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
4
4
private import semmle.code.cpp.ir.IR
5
5
6
6
/**
7
- * A predictable expression is one where an external user can predict
7
+ * A predictable instruction is one where an external user can predict
8
8
* the value. For example, a literal in the source code is considered
9
9
* predictable.
10
10
*/
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
15
13
or
16
- exists ( BinaryOperation binop | binop = expr |
17
- predictable ( binop .getLeftOperand ( ) ) and predictable ( binop .getRightOperand ( ) )
18
- )
14
+ instr instanceof StringConstantInstruction
19
15
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 ( ) )
26
18
}
27
19
28
20
private class DefaultTaintTrackingCfg extends DataFlow:: Configuration {
You can’t perform that action at this time.
0 commit comments