From: DJ Delorie Date: Tue, 5 Dec 2000 19:08:13 +0000 (+0000) Subject: * cp-demangle.c (cplus_demangle_v3): Check that it's a v3 mangled X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=849ee22471a973ae9dddc32f20b6a597040bc204;p=binutils-gdb.git * cp-demangle.c (cplus_demangle_v3): Check that it's a v3 mangled name before allocating the dyn_string. --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 33f39fe81ca..5b1af4ac241 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,8 @@ +2000-12-05 Jason Merrill + + * cp-demangle.c (cplus_demangle_v3): Check that it's a v3 mangled + name before allocating the dyn_string. + 2000-12-05 Jason Merrill * cp-demangle.c: s/new_abi/v3/. 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. */ {