C++: Add comments to {Array,Pointer}StoreNode and arrayStoreStepChi.

This commit is contained in:
Mathias Vorreiter Pedersen
2020-09-15 16:03:21 +02:00
parent 0c14e2b69a
commit 50ad4cfec4
2 changed files with 12 additions and 0 deletions

View File

@@ -244,11 +244,15 @@ private predicate arrayStoreStepChi(Node node1, ArrayContent a, PostUpdateNode n
node1.asInstruction() = store and
(
// `x[i] = taint()`
// This matches the characteristic predicate in `ArrayStoreNode`.
store.getDestinationAddress() instanceof PointerAddInstruction
or
// `*p = taint()`
// This matches the characteristic predicate in `PointerStoreNode`.
store.getDestinationAddress().(CopyValueInstruction).getUnary() instanceof LoadInstruction
) and
// This `ChiInstruction` will always have a non-conflated result because both `ArrayStoreNode`
// and `PointerStoreNode` require it in their characteristic predicates.
node2.asInstruction().(ChiInstruction).getPartial() = store
)
}

View File

@@ -389,6 +389,10 @@ private class ExplicitSingleFieldStoreQualifierNode extends PartialDefinitionNod
}
}
/**
* The `PostUpdateNode` that is the target of a `arrayStoreStepChi` store step. The overriden
* `ChiInstruction` corresponds to the instruction represented by `node2` in `arrayStoreStepChi`.
*/
private class ArrayStoreNode extends PartialDefinitionNode {
override ChiInstruction instr;
PointerAddInstruction add;
@@ -406,6 +410,10 @@ private class ArrayStoreNode extends PartialDefinitionNode {
override Expr getDefinedExpr() { result = add.getLeft().getUnconvertedResultExpression() }
}
/**
* The `PostUpdateNode` that is the target of a `arrayStoreStepChi` store step. The overriden
* `ChiInstruction` corresponds to the instruction represented by `node2` in `arrayStoreStepChi`.
*/
private class PointerStoreNode extends PostUpdateNode {
override ChiInstruction instr;