[demangler] Fix a exponential string copying bug
authorErik Pilkington <erik.pilkington@gmail.com>
Sun, 28 May 2017 23:15:50 +0000 (23:15 +0000)
committerErik Pilkington <erik.pilkington@gmail.com>
Sun, 28 May 2017 23:15:50 +0000 (23:15 +0000)
commita34ea7583fb292454ba3808b62a06da07c609fdb
treee8620f17bd09e3ddee08d56195b3233b6cd1a69e
parenta288ec412f3ffe2f5b2a985cba0553bc95ac591b
[demangler] Fix a exponential string copying bug

The problem was that if base_name() was called from a context without
an actual base name, it could gulp up the entire string, which can
result in recursive duplications. The fix is to be more strict as to
what qualifies as a base name.

Differential revision: https://reviews.llvm.org/D33637

llvm-svn: 304113
libcxxabi/src/cxa_demangle.cpp
libcxxabi/test/test_demangle.pass.cpp