[llvm] r188216 - DataFlowSanitizer: fix a use-after-free. Spotted by libgmalloc.
Peter Collingbourne
peter at pcc.me.uk
Mon Aug 12 15:38:39 PDT 2013
Author: pcc
Date: Mon Aug 12 17:38:39 2013
New Revision: 188216
URL: http://llvm.org/viewvc/llvm-project?rev=188216&view=rev
Log:
DataFlowSanitizer: fix a use-after-free. Spotted by libgmalloc.
Modified:
llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp?rev=188216&r1=188215&r2=188216&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Mon Aug 12 17:38:39 2013
@@ -422,9 +422,12 @@ bool DataFlowSanitizer::runOnModule(Modu
// instruction's next pointer and moving the next instruction to the
// tail block from which we should continue.
Instruction *Next = Inst->getNextNode();
+ // DFSanVisitor may delete Inst, so keep track of whether it was a
+ // terminator.
+ bool IsTerminator = isa<TerminatorInst>(Inst);
if (!DFSF.SkipInsts.count(Inst))
DFSanVisitor(DFSF).visit(Inst);
- if (isa<TerminatorInst>(Inst))
+ if (IsTerminator)
break;
Inst = Next;
}
More information about the llvm-commits
mailing list