Skip to content

Commit eb2790a

Browse files
committed
C++: Fix 'case 2' in 'destroyedToBeginSink' now that we're working with the sink instead of the source.
1 parent d22e2ba commit eb2790a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-416/IteratorToExpiredContainer.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ DataFlow::Node getADestroyedNode() {
6565
isPostUpdateOfQualifier(destructorCall, result)
6666
)
6767
or
68+
// Case 2: Anything that was derived from the temporary that is now destroyed
69+
// is also destroyed.
6870
exists(CallInstruction call |
6971
result.asInstruction() = call and
70-
DataFlow::localFlow(destroyedTemp.getNode(),
71-
DataFlow::operandNode(call.getThisArgumentOperand()))
72+
DataFlow::localFlow(DataFlow::operandNode(call.getThisArgumentOperand()), n)
7273
|
7374
call.getStaticCallTarget() instanceof StdSequenceContainerAt or
7475
call.getStaticCallTarget() instanceof StdMapAt

0 commit comments

Comments
 (0)