d-demangle.c (dlang_parse_tuple): Correctly handle error result.
authorBen L <bobsayshilol@live.co.uk>
Tue, 30 Apr 2019 14:37:51 +0000 (14:37 +0000)
committerJeff Law <law@gcc.gnu.org>
Tue, 30 Apr 2019 14:37:51 +0000 (08:37 -0600)
     * d-demangle.c (dlang_parse_tuple): Correctly handle error result.
     * testsuite/d-demangle-expected: Add testcase.

From-SVN: r270699

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

index f528bb4e73e06534c8469985aca7f7915b26fb92..104f0e8b20c3846f15a6c34aaace944b27f0a6fc 100644 (file)
@@ -1,5 +1,8 @@
 2019-04-30  Ben L  <bobsayshilol@live.co.uk>
 
+       * d-demangle.c (dlang_parse_tuple): Correctly handle error result.
+       * testsuite/d-demangle-expected: Add testcase.
+
        * d-demangle.c (dlang_parse_structlit): Correctly handle error result.
        * testsuite/d-demangle-expected: Add testcase.
 
index 5590417c205ca708b5d81533cea10068ce98e52e..e98118e66d2c458fc906851b124625670983a8c3 100644 (file)
@@ -1503,6 +1503,9 @@ dlang_parse_tuple (string *decl, const char *mangled)
   while (elements--)
     {
       mangled = dlang_type (decl, mangled);
+      if (mangled == NULL)
+       return NULL;
+
       if (elements != 0)
        string_append (decl, ", ");
     }
index 0a5f9da8091ed3d13ef50a117a6b211f647730ea..44a8d3b079340a95521ac2a5e87b95dfe360a82e 100644 (file)
@@ -1318,3 +1318,7 @@ _D5__T2fnVmA1A1A911111111D
 --format=dlang
 _D7__T2fnVlS8S588888888888S6S5
 _D7__T2fnVlS8S588888888888S6S5
+# Could crash
+--format=dlang
+_D1_B699999999961*
+_D1_B699999999961*