File tree Expand file tree Collapse file tree
cpp/ql/src/semmle/code/cpp/ir/dataflow Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,6 +145,11 @@ module TaintTracking {
145145 nodeTo instanceof PointerArithmeticInstruction
146146 or
147147 nodeTo instanceof FieldAddressInstruction
148+ or
149+ // The `CopyInstruction` case is also present in non-taint data flow, but
150+ // that uses `getDef` rather than `getAnyDef`. For taint, we want flow
151+ // from a definition of `myStruct` to a `myStruct.myField` expression.
152+ nodeTo instanceof CopyInstruction
148153 )
149154 or
150155 nodeTo .( LoadInstruction ) .getSourceAddress ( ) = nodeFrom
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ UninitializedNode uninitializedNode(LocalVariable v) { result.getLocalVariable()
143143 */
144144predicate localFlowStep ( Node nodeFrom , Node nodeTo ) {
145145 nodeTo .( CopyInstruction ) .getSourceValue ( ) = nodeFrom or
146- nodeTo .( PhiInstruction ) .getAnOperand ( ) .getAnyDef ( ) = nodeFrom or
146+ nodeTo .( PhiInstruction ) .getAnOperand ( ) .getDef ( ) = nodeFrom or
147147 // Treat all conversions as flow, even conversions between different numeric types.
148148 nodeTo .( ConvertInstruction ) .getUnary ( ) = nodeFrom
149149}
You can’t perform that action at this time.
0 commit comments