Skip to content

Commit 8ac1d56

Browse files
committed
C++: Fix join order in cpp/invalid-pointer-deref
1 parent ac4933a commit 8ac1d56

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-193/InvalidPointerDeref.ql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ predicate isSinkImpl(
182182
/**
183183
* Yields any instruction that is control-flow reachable from `instr`.
184184
*/
185+
bindingset[instr, result]
186+
pragma[inline_late]
185187
Instruction getASuccessor(Instruction instr) {
186188
exists(IRBlock b, int instrIndex, int resultIndex |
187189
result.getBlock() = b and
@@ -202,11 +204,12 @@ Instruction getASuccessor(Instruction instr) {
202204
*/
203205
pragma[inline]
204206
predicate isInvalidPointerDerefSink(DataFlow::Node sink, Instruction i, string operation, int delta) {
205-
exists(AddressOperand addr |
206-
bounded1(addr.getDef(), sink.asInstruction(), delta) and
207+
exists(AddressOperand addr, Instruction s |
208+
s = sink.asInstruction() and
209+
bounded1(addr.getDef(), s, delta) and
207210
delta >= 0 and
208211
i.getAnOperand() = addr and
209-
i = getASuccessor(sink.asInstruction())
212+
i = getASuccessor(s)
210213
|
211214
i instanceof StoreInstruction and
212215
operation = "write"

0 commit comments

Comments
 (0)