summaryrefslogtreecommitdiffstats
path: root/libiberty/cp-demangle.c
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/cp-demangle.c
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/cp-demangle.c')
-rw-r--r--libiberty/cp-demangle.c6
1 files changed, 5 insertions, 1 deletions
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')
OpenPOWER on IntegriCloud