summaryrefslogtreecommitdiffstats
path: root/libiberty
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-01 16:39:36 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-01 16:39:36 +0000
commitd8d90ee3bdeb439ed1830c8a1f55fecee2324cf1 (patch)
tree7744a0d4af9a91fd4e1d2806ae59bd0185837e9a /libiberty
parent86b72d1d0574029e92fc2bd0b095a69b10ba1395 (diff)
downloadppe42-gcc-d8d90ee3bdeb439ed1830c8a1f55fecee2324cf1.tar.gz
ppe42-gcc-d8d90ee3bdeb439ed1830c8a1f55fecee2324cf1.zip
PR other/22268
* cp-demangle.c (d_expr_primary): Don't run off the end of the string while looking for the end of a literal value. * testsuite/demangle-expected: Add test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101506 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog7
-rw-r--r--libiberty/cp-demangle.c6
-rw-r--r--libiberty/testsuite/demangle-expected6
3 files changed, 18 insertions, 1 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 2522b8270e6..eb19aa71e4c 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,10 @@
+2005-07-01 Ian Lance Taylor <ian@airs.com>
+
+ PR other/22268
+ * cp-demangle.c (d_expr_primary): Don't run off the end of the
+ string while looking for the end of a literal value.
+ * testsuite/demangle-expected: Add test case.
+
2005-06-30 Daniel Berlin <dberlin@dberlin.org>
* hashtab.c (EMPTY_ENTRY): Moved and renamed.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 61744390725..8f1cfb17f87 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -2337,7 +2337,11 @@ d_expr_primary (struct d_info *di)
}
s = d_str (di);
while (d_peek_char (di) != 'E')
- d_advance (di, 1);
+ {
+ if (d_peek_char (di) == '\0')
+ return NULL;
+ d_advance (di, 1);
+ }
ret = d_make_comp (di, t, type, d_make_name (di, s, d_str (di) - s));
}
if (d_next_char (di) != 'E')
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index f8e402d01bd..4526773a780 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -3704,6 +3704,12 @@ foo<int (*) [3]>
_ZN13PatternDriver23StringScalarDeleteValueC1ERKNS_25ConflateStringScalarValueERKNS_25AbstractStringScalarValueERKNS_12TemplateEnumINS_12pdcomplementELZNS_16complement_namesEELZNS_14COMPLEMENTENUMEEEE
_ZN13PatternDriver23StringScalarDeleteValueC1ERKNS_25ConflateStringScalarValueERKNS_25AbstractStringScalarValueERKNS_12TemplateEnumINS_12pdcomplementELZNS_16complement_namesEELZNS_14COMPLEMENTENUMEEEE
PatternDriver::StringScalarDeleteValue::StringScalarDeleteValue
+#
+# This used to cause the demangler to walk into undefined memory--PR 22268
+--format=gnu-v3 --no-params
+ALsetchannels
+ALsetchannels
+ALsetchannels
# Test GNU V3 constructor and destructor identification.
# 0 means it is not a constructor/destructor.
# Other integers correspond to enum gnu_v3_{c,d}tor_kinds in demangle.h.
OpenPOWER on IntegriCloud