Skip to content

Commit 889dcfe

Browse files
authored
Merge pull request github#12674 from jketema/overrunning-join
C++: Fix join-order problem in cpp/overrun-write
2 parents 0b9d16a + 213c4b0 commit 889dcfe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cpp/ql/src/experimental/Likely Bugs/OverrunWriteProductFlow.ql

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,16 @@ predicate hasSize(AllocationExpr alloc, DataFlow::Node n, string state) {
6262
predicate isSinkPairImpl(
6363
CallInstruction c, DataFlow::Node bufSink, DataFlow::Node sizeSink, int delta, Expr eBuf
6464
) {
65-
exists(int bufIndex, int sizeIndex, Instruction sizeInstr, Instruction bufInstr |
65+
exists(
66+
int bufIndex, int sizeIndex, Instruction sizeInstr, Instruction bufInstr, ArrayFunction func
67+
|
6668
bufInstr = bufSink.asInstruction() and
6769
c.getArgument(bufIndex) = bufInstr and
6870
sizeInstr = sizeSink.asInstruction() and
69-
c.getStaticCallTarget().(ArrayFunction).hasArrayWithVariableSize(bufIndex, sizeIndex) and
71+
c.getStaticCallTarget() = func and
72+
pragma[only_bind_into](func)
73+
.hasArrayWithVariableSize(pragma[only_bind_into](bufIndex),
74+
pragma[only_bind_into](sizeIndex)) and
7075
bounded(c.getArgument(sizeIndex), sizeInstr, delta) and
7176
eBuf = bufInstr.getUnconvertedResultExpression()
7277
)

0 commit comments

Comments
 (0)