cp-demangle.c (d_encoding): Guard against NULL return values from d_right (dc).
authorBen L <bobsayshilol@live.co.uk>
Tue, 30 Apr 2019 14:20:11 +0000 (14:20 +0000)
committerJeff Law <law@gcc.gnu.org>
Tue, 30 Apr 2019 14:20:11 +0000 (08:20 -0600)
     * cp-demangle.c (d_encoding): Guard against NULL return values from
     d_right (dc).
     * testsuite/demangle-expected: Add testcase.

From-SVN: r270694

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

index 70fc973a627de5877c73c6586a697c917f899e7c..25a219a8cebc06b928abe54860c99c8090ec4cd1 100644 (file)
@@ -1,3 +1,9 @@
+2019-04-30  Ben L  <bobsayshilol@live.co.uk>
+
+       * cp-demangle.c (d_encoding): Guard against NULL return values from
+       d_right (dc).
+       * testsuite/demangle-expected: Add testcase.
+
 2019-04-29  Ben L  <bobsayshilol@live.co.uk>
 
        * cp-demangle.c (d_expression_1): Don't peek ahead unless the current
index fcc2a209857046367568cc19f8d07e1adefd9b5f..f8c4c1d365dee957f5b5a469147e8e1b999ebc30 100644 (file)
@@ -1330,8 +1330,14 @@ d_encoding (struct d_info *di, int top_level)
             really apply here; this happens when parsing a class
             which is local to a function.  */
          if (dc->type == DEMANGLE_COMPONENT_LOCAL_NAME)
-           while (is_fnqual_component_type (d_right (dc)->type))
-             d_right (dc) = d_left (d_right (dc));
+           {
+             while (d_right (dc) != NULL
+                    && is_fnqual_component_type (d_right (dc)->type))
+               d_right (dc) = d_left (d_right (dc));
+
+             if (d_right (dc) == NULL)
+               dc = NULL;
+           }
        }
       else
        {
index 328d51a84e99887366763041bcb136ac708e6fd8..eb5264dba40fc0dc08e6deffc49149a9cc1cd7bb 100644 (file)
@@ -72,6 +72,11 @@ _Q8ccQ4M2e.
 
 _ZmmAtl
 _ZmmAtl
+# Could crash
+--no-params
+_ZZaSFvOEES_
+_ZZaSFvOEES_
+_ZZaSFvOEES_
 #
 # demangler/80513 Test for bogus characters after __thunk_