diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-05 17:29:12 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-05 17:29:12 +0000 |
commit | cf0ad6a8d1897a10002e7f3b1bb38ff0f709f767 (patch) | |
tree | 5ee6a7415e7a494832f2584dde1f4545083edad7 /libiberty/cp-demangle.c | |
parent | cda0a5f5169ba24c274b3e7d24f2d82b993adc5b (diff) | |
download | gcc-cf0ad6a8d1897a10002e7f3b1bb38ff0f709f767.tar.gz |
* cp-demangle.c (cplus_demangle_v3): Check that it's a v3 mangled
name before allocating the dyn_string.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38043 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/cp-demangle.c')
-rw-r--r-- | libiberty/cp-demangle.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 5787f74744f..1cc4847d4e7 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -3600,10 +3600,18 @@ char * cplus_demangle_v3 (mangled) const char* mangled; { + dyn_string_t demangled; + status_t status; + + /* If this isn't a mangled name, don't pretend to demangle it. */ + if (strncmp (mangled, "_Z", 2) != 0) + return NULL; + /* Create a dyn_string to hold the demangled name. */ - dyn_string_t demangled = dyn_string_new (0); + demangled = dyn_string_new (0); /* Attempt the demangling. */ - status_t status = cp_demangle ((char *) mangled, demangled); + status = cp_demangle ((char *) mangled, demangled); + if (STATUS_NO_ERROR (status)) /* Demangling succeeded. */ { |