diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-12 22:38:39 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-12 22:38:39 +0000 |
commit | fb3a2b4f9782d00b3ace7a05ab1bec8467639bf0 (patch) | |
tree | d475c50f55bee771a75f7665125268f4393439ef /llvm/lib/Transforms | |
parent | fc455471c39ff930b166d91f8de7f2e04a73d4dd (diff) | |
download | bcm5719-llvm-fb3a2b4f9782d00b3ace7a05ab1bec8467639bf0.tar.gz bcm5719-llvm-fb3a2b4f9782d00b3ace7a05ab1bec8467639bf0.zip |
DataFlowSanitizer: fix a use-after-free. Spotted by libgmalloc.
llvm-svn: 188216
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp index f5531e00676..af227d27d92 100644 --- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -422,9 +422,12 @@ bool DataFlowSanitizer::runOnModule(Module &M) { // 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; } |