aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2000-12-05 19:08:13 +0000
committerDJ Delorie <dj@redhat.com>2000-12-05 19:08:13 +0000
commit849ee22471a973ae9dddc32f20b6a597040bc204 (patch)
tree822c50008a7112443b58e4ce093b9dcb3302aee9 /libiberty
parentbeae10d5eb86db2afbf75b69774bf9431c9900ac (diff)
downloadgdb-849ee22471a973ae9dddc32f20b6a597040bc204.zip
gdb-849ee22471a973ae9dddc32f20b6a597040bc204.tar.gz
gdb-849ee22471a973ae9dddc32f20b6a597040bc204.tar.bz2
* cp-demangle.c (cplus_demangle_v3): Check that it's a v3 mangled
name before allocating the dyn_string.
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog5
-rw-r--r--libiberty/cp-demangle.c12
2 files changed, 15 insertions, 2 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 33f39fe..5b1af4a 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,5 +1,10 @@
2000-12-05 Jason Merrill <jason@redhat.com>
+ * cp-demangle.c (cplus_demangle_v3): Check that it's a v3 mangled
+ name before allocating the dyn_string.
+
+2000-12-05 Jason Merrill <jason@redhat.com>
+
* cp-demangle.c: s/new_abi/v3/.
* cplus-dem.c: Likewise.
(current_demangling_style): Now auto_demangling.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 5787f74..1cc4847 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. */
{