From 14fe17f302580ebd39cf8cea8dd5aa05457ad347 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Wed, 11 Dec 2013 19:44:25 +0000 Subject: Fix demangling crasher. The crasher involved nested involving parameter packs, which exposed a logic bug causing an empty vector 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 --- libcxxabi/test/test_demangle.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libcxxabi/test/test_demangle.cpp') 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)"}, {"_Z1fPKU11objcproto1A7NSArray", "f(NSArray const*)"}, {"_ZNK1AIJ1Z1Y1XEEcv1BIJDpPT_EEIJS2_S1_S0_EEEv", "A::operator B() 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; -- cgit v1.2.3