From: Ben L Date: Mon, 29 Apr 2019 22:19:01 +0000 (+0000) Subject: cp-demangle.c (d_expression_1): Don't peek ahead unless the current char is valid. X-Git-Tag: misc/cutover-git~5856 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=956bea2cd6110f104f12d5861143efc71213c140;p=thirdparty%2Fgcc.git cp-demangle.c (d_expression_1): Don't peek ahead unless the current char is valid. * cp-demangle.c (d_expression_1): Don't peek ahead unless the current char is valid. * testsuite/demangle-expected: Add testcase. From-SVN: r270664 --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 06ff39a26564..70fc973a627d 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +2019-04-29 Ben L + + * cp-demangle.c (d_expression_1): Don't peek ahead unless the current + char is valid. + * testsuite/demangle-expected: Add testcase. + 2019-04-10 Nick Clifton PR 89394 diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 779b4e763a05..fcc2a2098570 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -3359,7 +3359,7 @@ d_expression_1 (struct d_info *di) d_advance (di, 2); if (peek == 't') type = cplus_demangle_type (di); - if (!d_peek_next_char (di)) + if (!d_peek_char (di) || !d_peek_next_char (di)) return NULL; return d_make_comp (di, DEMANGLE_COMPONENT_INITIALIZER_LIST, type, d_exprlist (di, 'E')); diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 3723b7a90f1d..328d51a84e99 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -68,6 +68,10 @@ _$_H1R _Q8ccQ4M2e. _Q8ccQ4M2e. +# Could crash + +_ZmmAtl +_ZmmAtl # # demangler/80513 Test for bogus characters after __thunk_