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

From-SVN: r270698

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

index 71d446bec1c889937d38ebfae042d407eabedbcf..f528bb4e73e06534c8469985aca7f7915b26fb92 100644 (file)
@@ -1,5 +1,8 @@
 2019-04-30  Ben L  <bobsayshilol@live.co.uk>
 
+       * d-demangle.c (dlang_parse_structlit): Correctly handle error result.
+       * testsuite/d-demangle-expected: Add testcase.
+
        * d-demangle.c (dlang_parse_arrayliteral): Correctly handle error result.
        * testsuite/d-demangle-expected: Add testcase.
 
index 303d2eeafad8de1b0d2cd58d3689cc8232b42dd8..5590417c205ca708b5d81533cea10068ce98e52e 100644 (file)
@@ -1246,6 +1246,9 @@ dlang_parse_structlit (string *decl, const char *mangled, const char *name)
   while (args--)
     {
       mangled = dlang_value (decl, mangled, NULL, '\0');
+      if (mangled == NULL)
+       return NULL;
+
       if (args != 0)
        string_append (decl, ", ");
     }
index 19665f5562444f67099ba1f1d55afea9d9425c2b..0a5f9da8091ed3d13ef50a117a6b211f647730ea 100644 (file)
@@ -1314,3 +1314,7 @@ _D8__T2fnVa8888888888888_
 --format=dlang
 _D5__T2fnVmA1A1A911111111D
 _D5__T2fnVmA1A1A911111111D
+# Could crash
+--format=dlang
+_D7__T2fnVlS8S588888888888S6S5
+_D7__T2fnVlS8S588888888888S6S5