[ItaniumDemangle] Fix a exponential string copying bug
authorErik Pilkington <erik.pilkington@gmail.com>
Sun, 28 May 2017 23:24:52 +0000 (23:24 +0000)
committerErik Pilkington <erik.pilkington@gmail.com>
Sun, 28 May 2017 23:24:52 +0000 (23:24 +0000)
This is a port of libcxxabi's r304113.

llvm-svn: 304114

llvm/lib/Demangle/ItaniumDemangle.cpp

index 03d11a7..34f4017 100644 (file)
@@ -2525,6 +2525,9 @@ static std::string base_name(std::string &s) {
       ++p0;
       break;
     }
+    if (!isalpha(*p0) && !isdigit(*p0) && *p0 != '_') {
+      return std::string();
+    }
   }
   return std::string(p0, pe);
 }