Skip to content

Commit 2448475

Browse files
committed
C++: Ensure that 'argumentOf' does not map to multiple argument positions.
1 parent 9970f78 commit 2448475

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ private class SideEffectArgumentNode extends ArgumentNode, SideEffectOperandNode
382382
exists(int indirectionIndex |
383383
pos = TIndirectionPosition(argumentIndex, pragma[only_bind_into](indirectionIndex)) and
384384
this.getCallInstruction() = dfCall.asCallInstruction() and
385-
super.hasAddressOperandAndIndirectionIndex(_, pragma[only_bind_into](indirectionIndex))
385+
super.hasAddressOperandAndIndirectionIndex(arg, pragma[only_bind_into](indirectionIndex))
386386
)
387387
}
388388
}

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,9 +757,11 @@ class SsaIteratorNode extends Node, TSsaIteratorNode {
757757
class SideEffectOperandNode extends Node instanceof IndirectOperand {
758758
CallInstruction call;
759759
int argumentIndex;
760+
ArgumentOperand arg;
760761

761762
SideEffectOperandNode() {
762-
IndirectOperand.super.hasOperandAndIndirectionIndex(call.getArgumentOperand(argumentIndex), _)
763+
arg = call.getArgumentOperand(argumentIndex) and
764+
IndirectOperand.super.hasOperandAndIndirectionIndex(arg, _)
763765
}
764766

765767
CallInstruction getCallInstruction() { result = call }

0 commit comments

Comments
 (0)