cp-demangle.c (d_expression_1): Don't peek ahead unless the current char is valid.
authorBen L <bobsayshilol@live.co.uk>
Mon, 29 Apr 2019 22:19:01 +0000 (22:19 +0000)
committerJeff Law <law@gcc.gnu.org>
Mon, 29 Apr 2019 22:19:01 +0000 (16:19 -0600)
* cp-demangle.c (d_expression_1): Don't peek ahead unless the current
char is valid.
* testsuite/demangle-expected: Add testcase.

From-SVN: r270664

libiberty/ChangeLog
libiberty/cp-demangle.c
libiberty/testsuite/demangle-expected

index 06ff39a265645773b123e3efcf132cbd98c3dc3d..70fc973a627de5877c73c6586a697c917f899e7c 100644 (file)
@@ -1,3 +1,9 @@
+2019-04-29  Ben L  <bobsayshilol@live.co.uk>
+
+       * cp-demangle.c (d_expression_1): Don't peek ahead unless the current
+       char is valid.
+       * testsuite/demangle-expected: Add testcase.
+
 2019-04-10  Nick Clifton  <nickc@redhat.com>
 
        PR 89394
index 779b4e763a05f8328c40fe3775753af9947001d6..fcc2a209857046367568cc19f8d07e1adefd9b5f 100644 (file)
@@ -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'));
index 3723b7a90f1d5bc60b34cd8cfd3364539cb9aa40..328d51a84e99887366763041bcb136ac708e6fd8 100644 (file)
@@ -68,6 +68,10 @@ _$_H1R
 
 _Q8ccQ4M2e.
 _Q8ccQ4M2e.
+# Could crash
+
+_ZmmAtl
+_ZmmAtl
 #
 # demangler/80513 Test for bogus characters after __thunk_