aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorBen L <bobsayshilol@live.co.uk>2019-04-30 14:37:51 +0000
committerJeff Law <law@gcc.gnu.org>2019-04-30 08:37:51 -0600
commitf181b8e780c139ae73fe41f93492847aaede40cf (patch)
treeec54298bf9194342577e76ca3369548918c1cddf /libiberty
parentdba20a51404e7addd5e76dc8b912ecaa4469ef03 (diff)
downloadgcc-f181b8e780c139ae73fe41f93492847aaede40cf.zip
gcc-f181b8e780c139ae73fe41f93492847aaede40cf.tar.gz
gcc-f181b8e780c139ae73fe41f93492847aaede40cf.tar.bz2
d-demangle.c (dlang_parse_tuple): Correctly handle error result.
* d-demangle.c (dlang_parse_tuple): Correctly handle error result. * testsuite/d-demangle-expected: Add testcase. From-SVN: r270699
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog3
-rw-r--r--libiberty/d-demangle.c3
-rw-r--r--libiberty/testsuite/d-demangle-expected4
3 files changed, 10 insertions, 0 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index f528bb4..104f0e8 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -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.
diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index 5590417..e98118e 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -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, ", ");
}
diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected
index 0a5f9da..44a8d3b 100644
--- a/libiberty/testsuite/d-demangle-expected
+++ b/libiberty/testsuite/d-demangle-expected
@@ -1318,3 +1318,7 @@ _D5__T2fnVmA1A1A911111111D
--format=dlang
_D7__T2fnVlS8S588888888888S6S5
_D7__T2fnVlS8S588888888888S6S5
+# Could crash
+--format=dlang
+_D1_B699999999961*
+_D1_B699999999961*