diff options
author | Ben L <bobsayshilol@live.co.uk> | 2019-04-30 14:34:52 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2019-04-30 08:34:52 -0600 |
commit | 80b1ab1579887f21a2d0d34abbe726cbff2706df (patch) | |
tree | 430c76bbb677c20c112af3dfddccee7b558a4a6b /libiberty | |
parent | 81adfd10c9527402ba94963e960b8f70ea52bdca (diff) | |
download | gcc-80b1ab1579887f21a2d0d34abbe726cbff2706df.zip gcc-80b1ab1579887f21a2d0d34abbe726cbff2706df.tar.gz gcc-80b1ab1579887f21a2d0d34abbe726cbff2706df.tar.bz2 |
d-demangle.c (dlang_parse_arrayliteral): Correctly handle error result.
* d-demangle.c (dlang_parse_arrayliteral): Correctly handle error result.
* testsuite/d-demangle-expected: Add testcase.
From-SVN: r270697
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 3 | ||||
-rw-r--r-- | libiberty/d-demangle.c | 3 | ||||
-rw-r--r-- | libiberty/testsuite/d-demangle-expected | 4 |
3 files changed, 10 insertions, 0 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 76a974d..71d446b 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_arrayliteral): Correctly handle error result. + * testsuite/d-demangle-expected: Add testcase. + * d-demangle.c (dlang_parse_integer): Fix stack underflow. * testsuite/d-demangle-expected: Add testcase. diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c index 114d9e0..303d2ee 100644 --- a/libiberty/d-demangle.c +++ b/libiberty/d-demangle.c @@ -1191,6 +1191,9 @@ dlang_parse_arrayliteral (string *decl, const char *mangled) while (elements--) { mangled = dlang_value (decl, mangled, NULL, '\0'); + 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 9988238..19665f5 100644 --- a/libiberty/testsuite/d-demangle-expected +++ b/libiberty/testsuite/d-demangle-expected @@ -1310,3 +1310,7 @@ core.demangle.mangle!(void*() function).mangle(const(char)[], char[]).DotSplitte --format=dlang _D8__T2fnVa8888888888888_ _D8__T2fnVa8888888888888_ +# Could crash +--format=dlang +_D5__T2fnVmA1A1A911111111D +_D5__T2fnVmA1A1A911111111D |