Skip to content

Commit 0859c4f

Browse files
committed
C++: Fix swapped arguments in 'invalidPointerToDerefSource'.
1 parent 69ea7d9 commit 0859c4f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cpp/ql/lib/semmle/code/cpp/security/InvalidPointerDereference/InvalidPointerToDereference.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ private predicate invalidPointerToDerefSource(
102102
// delta is the constant difference between the pointer-arithmetic instruction
103103
// and the instruction computing the address for which we will search for a dereference.
104104
AllocToInvalidPointer::pointerAddInstructionHasBounds(source1, pai, _, delta0) and
105-
bounded2(derefSource.asInstruction(), pai, delta) and
106-
delta >= 0 and
105+
// pai <= derefSource + delta and delta <= 0 is equivalent to
106+
// derefSource >= pai + delta and delta >= 0
107+
bounded1(pai, derefSource.asInstruction(), delta) and
108+
delta <= 0 and
107109
// TODO: This condition will go away once #13725 is merged, and then we can make `Barrier2`
108110
// private to `AllocationToInvalidPointer.qll`.
109111
not derefSource.getBasicBlock() = AllocToInvalidPointer::Barrier2::getABarrierBlock(delta0)

0 commit comments

Comments
 (0)