From aa8cc0a53946665c37f4ad639ae380f72a483e8b Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Fri, 10 Mar 2017 15:36:26 -0800 Subject: [PATCH] demangler: fix a crash when trying to demangle a non-swift symbol rdar://problem/30982254 --- lib/Demangling/Demangler.cpp | 2 ++ test/Demangle/Inputs/manglings.txt | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/Demangling/Demangler.cpp b/lib/Demangling/Demangler.cpp index 26ce4fe309616..05db8b5aa0ef7 100644 --- a/lib/Demangling/Demangler.cpp +++ b/lib/Demangling/Demangler.cpp @@ -626,6 +626,8 @@ NodePointer Demangler::demangleIdentifier() { NodePointer Demangler::demangleOperatorIdentifier() { NodePointer Ident = popNode(Node::Kind::Identifier); + if (!Ident) + return nullptr; static const char op_char_table[] = "& @/= > <*!|+?%-~ ^ ."; diff --git a/test/Demangle/Inputs/manglings.txt b/test/Demangle/Inputs/manglings.txt index 3aa19f6b427e6..a7881ba7c593f 100644 --- a/test/Demangle/Inputs/manglings.txt +++ b/test/Demangle/Inputs/manglings.txt @@ -244,4 +244,5 @@ _T0s17MutableCollectionP1asAARzs012RandomAccessB0RzsAA11SubSequences013Bidirecti _T03foo4_123ABTf3psbpsb_n ---> function signature specialization of foo _T04main5innerys5Int32Vz_yADctF25closure_with_box_argumentxz_Bi32__lXXTf1nc_n ---> function signature specialization { var A } ]> of main.inner (inout Swift.Int32, (Swift.Int32) -> ()) -> () _T03foo6testityyyc_yyctF1a1bTf3pfpf_n ---> function signature specialization of foo.testit (() -> (), () -> ()) -> () +_SocketJoinOrLeaveMulticast ---> _SocketJoinOrLeaveMulticast