Skip to content

Commit 3e6ac74

Browse files
committed
C++: Add 'InheritanceConversionInstruction' to the list of instructions that set 'certain = false' in 'explicitWrite'.
1 parent 56cabb8 commit 3e6ac74

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,14 @@ predicate explicitWrite(boolean certain, Instruction instr, Instruction address)
315315
exists(StoreInstruction store |
316316
store = instr and addressFlowTC(address, store.getDestinationAddress())
317317
|
318+
// Set `certain = false` if the address is derived from any instructions that prevents us from
319+
// concluding that the entire variable is overridden.
318320
if
319321
addressFlowTC(any(Instruction i |
320322
i instanceof FieldAddressInstruction or
321323
i instanceof PointerArithmeticInstruction or
322-
i instanceof LoadInstruction
324+
i instanceof LoadInstruction or
325+
i instanceof InheritanceConversionInstruction
323326
), store.getDestinationAddress())
324327
then certain = false
325328
else certain = true

0 commit comments

Comments
 (0)