summaryrefslogtreecommitdiffstats
path: root/libcxxabi/test/test_demangle.cpp
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-12-11 19:44:25 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-12-11 19:44:25 +0000
commit14fe17f302580ebd39cf8cea8dd5aa05457ad347 (patch)
tree0b4b2c5db5f48fd2eedb0fb69723db002af4345b /libcxxabi/test/test_demangle.cpp
parentc4cb5d900e2377dad24c5cae493b9f644ac769cb (diff)
downloadbcm5719-llvm-14fe17f302580ebd39cf8cea8dd5aa05457ad347.tar.gz
bcm5719-llvm-14fe17f302580ebd39cf8cea8dd5aa05457ad347.zip
Fix demangling crasher. The crasher involved nested <encoding> involving parameter packs, which exposed a logic bug causing an empty vector<string> to be accessed with back(). In addition to fixing the bug, I've inserted numerous preemptive checks for similar bugs in the hopes that if another bug is uncovered, the bug results in an invalid mangled string instead of a demangler crash. Test suite updated with string that was causing the crash.
llvm-svn: 197063
Diffstat (limited to 'libcxxabi/test/test_demangle.cpp')
-rw-r--r--libcxxabi/test/test_demangle.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libcxxabi/test/test_demangle.cpp b/libcxxabi/test/test_demangle.cpp
index 0b582d3bdf4..9bff745964b 100644
--- a/libcxxabi/test/test_demangle.cpp
+++ b/libcxxabi/test/test_demangle.cpp
@@ -29583,6 +29583,7 @@ const char* cases[][2] =
{"_Z1fPU11objcproto1A11objc_object", "f(id<A>)"},
{"_Z1fPKU11objcproto1A7NSArray", "f(NSArray<A> const*)"},
{"_ZNK1AIJ1Z1Y1XEEcv1BIJDpPT_EEIJS2_S1_S0_EEEv", "A<Z, Y, X>::operator B<X*, Y*, Z*><X, Y, Z>() const"},
+ {"_ZNK3Ncr6Silver7Utility6detail12CallOnThreadIZ53-[DeploymentSetupController handleManualServerEntry:]E3$_5EclIJEEEDTclclL_ZNS2_4getTIS4_EERT_vEEspclsr3stdE7forwardIT_Efp_EEEDpOSA_", "decltype(-[DeploymentSetupController handleManualServerEntry:]::$_5& Ncr::Silver::Utility::detail::getT<-[DeploymentSetupController handleManualServerEntry:]::$_5>()()(std::forward<-[DeploymentSetupController handleManualServerEntry:]::$_5>(fp))) Ncr::Silver::Utility::detail::CallOnThread<-[DeploymentSetupController handleManualServerEntry:]::$_5>::operator()<>(-[DeploymentSetupController handleManualServerEntry:]::$_5&&) const"},
};
const unsigned N = sizeof(cases) / sizeof(cases[0]);
@@ -29663,7 +29664,9 @@ int main()
std::string input;
while (std::cin)
{
- std::cin >> input;
+ std::getline(std::cin, input);
+ if (std::cin.fail())
+ break;
std::size_t len = 0;
int status;
len = 0;
OpenPOWER on IntegriCloud