summaryrefslogtreecommitdiff
path: root/libiberty/cp-demangle.c
diff options
context:
space:
mode:
authorBen L <bobsayshilol@live.co.uk>2019-04-29 22:19:01 +0000
committerJeff Law <law@gcc.gnu.org>2019-04-29 16:19:01 -0600
commit956bea2cd6110f104f12d5861143efc71213c140 (patch)
tree93fbd2fff674e214a9d87e8edd1a9bcb3689e160 /libiberty/cp-demangle.c
parent7fb1d0214e4654bbecd212c7f0c2254398b46b13 (diff)
cp-demangle.c (d_expression_1): Don't peek ahead unless the current char is valid.
* cp-demangle.c (d_expression_1): Don't peek ahead unless the current char is valid. * testsuite/demangle-expected: Add testcase. From-SVN: r270664
Diffstat (limited to 'libiberty/cp-demangle.c')
-rw-r--r--libiberty/cp-demangle.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 779b4e763a0..fcc2a209857 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -3359,7 +3359,7 @@ d_expression_1 (struct d_info *di)
d_advance (di, 2);
if (peek == 't')
type = cplus_demangle_type (di);
- if (!d_peek_next_char (di))
+ if (!d_peek_char (di) || !d_peek_next_char (di))
return NULL;
return d_make_comp (di, DEMANGLE_COMPONENT_INITIALIZER_LIST,
type, d_exprlist (di, 'E'));