summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAsmStreamer.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-08-30 22:25:55 +0000
committerReid Kleckner <rnk@google.com>2019-08-30 22:25:55 +0000
commit657a06c61928eb0ac36f58b5da71fc43785324f4 (patch)
tree658bf3bd09e69a273feab38b7536af895b983a68 /llvm/lib/MC/MCAsmStreamer.cpp
parent0300c3536a33c2be5dea1577702d0d052b95da18 (diff)
downloadbcm5719-llvm-657a06c61928eb0ac36f58b5da71fc43785324f4.tar.gz
bcm5719-llvm-657a06c61928eb0ac36f58b5da71fc43785324f4.zip
[MC] Avoid crashes from improperly nested or wrong target .seh_handlerdata directives
llvm-svn: 370540
Diffstat (limited to 'llvm/lib/MC/MCAsmStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCAsmStreamer.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 2b9bec38b40..d2f99efef22 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -1748,6 +1748,12 @@ void MCAsmStreamer::EmitWinEHHandlerData(SMLoc Loc) {
// We only do this so the section switch that terminates the handler
// data block is visible.
WinEH::FrameInfo *CurFrame = getCurrentWinFrameInfo();
+
+ // Do nothing if no frame is open. MCStreamer should've already reported an
+ // error.
+ if (!CurFrame)
+ return;
+
MCSection *TextSec = &CurFrame->Function->getSection();
MCSection *XData = getAssociatedXDataSection(TextSec);
SwitchSectionNoChange(XData);
OpenPOWER on IntegriCloud