C++ IR: allow inexact defs in taint tracking

This commit is contained in:
Jonas Jensen 2019-07-01 11:10:18 +02:00
Родитель 984405be2e
Коммит 2ce8612a05
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -145,6 +145,11 @@ module TaintTracking {
nodeTo instanceof PointerArithmeticInstruction
or
nodeTo instanceof FieldAddressInstruction
or
// The `CopyInstruction` case is also present in non-taint data flow, but
// that uses `getDef` rather than `getAnyDef`. For taint, we want flow
// from a definition of `myStruct` to a `myStruct.myField` expression.
nodeTo instanceof CopyInstruction
)
or
nodeTo.(LoadInstruction).getSourceAddress() = nodeFrom

Просмотреть файл

@ -143,7 +143,7 @@ UninitializedNode uninitializedNode(LocalVariable v) { result.getLocalVariable()
*/
predicate localFlowStep(Node nodeFrom, Node nodeTo) {
nodeTo.(CopyInstruction).getSourceValue() = nodeFrom or
nodeTo.(PhiInstruction).getAnOperand().getAnyDef() = nodeFrom or
nodeTo.(PhiInstruction).getAnOperand().getDef() = nodeFrom or
// Treat all conversions as flow, even conversions between different numeric types.
nodeTo.(ConvertInstruction).getUnary() = nodeFrom
}