diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-11-09 00:26:15 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-11-09 00:26:15 +0000 |
commit | 130d3d039ee8886084c8dfe038b3183db72f6788 (patch) | |
tree | 47fd5d0f119bcf9a4ed799e544c9de37a51e9e72 /lib | |
parent | 3d002375f1d6cb51cff6e40d00528cb3ce75a302 (diff) |
Fix a use-after-free introduced by r344915.
r344915 added a call to ApplyDebugLocation to the sanitizer check
function emitter. Some of the sanitizers are emitted in the function
epilogue though and the LexicalScopeStack is emptied out before. By
detecting this situation and early-exiting from ApplyDebugLocation the
fallback location is used, which is equivalent to the return location.
rdar://problem/45859802
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 1d999e446c..81cc07dddd 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -3538,7 +3538,7 @@ void CGDebugInfo::EmitLocation(CGBuilderTy &Builder, SourceLocation Loc) { // Update our current location setLocation(Loc); - if (CurLoc.isInvalid() || CurLoc.isMacroID()) + if (CurLoc.isInvalid() || CurLoc.isMacroID() || LexicalBlockStack.empty()) return; llvm::MDNode *Scope = LexicalBlockStack.back(); |