Commit 80024f31 by Ben L Committed by Jeff Law

cp-demangle (d_print_comp_inner): Guard against a NULL 'typed_name'.

    * cp-demangle (d_print_comp_inner): Guard against a NULL 'typed_name'.
    * testsuite/demangle-expected: Add testcase.

From-SVN: r270695
parent 927e42fd
2019-04-30 Ben L <bobsayshilol@live.co.uk> 2019-04-30 Ben L <bobsayshilol@live.co.uk>
* cp-demangle (d_print_comp_inner): Guard against a NULL 'typed_name'.
* testsuite/demangle-expected: Add testcase.
* cp-demangle.c (d_encoding): Guard against NULL return values from * cp-demangle.c (d_encoding): Guard against NULL return values from
d_right (dc). d_right (dc).
* testsuite/demangle-expected: Add testcase. * testsuite/demangle-expected: Add testcase.
......
...@@ -4767,12 +4767,8 @@ d_print_comp_inner (struct d_print_info *dpi, int options, ...@@ -4767,12 +4767,8 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
typed_name = d_right (typed_name); typed_name = d_right (typed_name);
if (typed_name->type == DEMANGLE_COMPONENT_DEFAULT_ARG) if (typed_name->type == DEMANGLE_COMPONENT_DEFAULT_ARG)
typed_name = typed_name->u.s_unary_num.sub; typed_name = typed_name->u.s_unary_num.sub;
if (typed_name == NULL) while (typed_name != NULL
{ && is_fnqual_component_type (typed_name->type))
d_print_error (dpi);
return;
}
while (is_fnqual_component_type (typed_name->type))
{ {
if (i >= sizeof adpm / sizeof adpm[0]) if (i >= sizeof adpm / sizeof adpm[0])
{ {
...@@ -4791,6 +4787,11 @@ d_print_comp_inner (struct d_print_info *dpi, int options, ...@@ -4791,6 +4787,11 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
typed_name = d_left (typed_name); typed_name = d_left (typed_name);
} }
if (typed_name == NULL)
{
d_print_error (dpi);
return;
}
} }
/* If typed_name is a template, then it applies to the /* If typed_name is a template, then it applies to the
......
...@@ -77,6 +77,10 @@ _ZmmAtl ...@@ -77,6 +77,10 @@ _ZmmAtl
_ZZaSFvOEES_ _ZZaSFvOEES_
_ZZaSFvOEES_ _ZZaSFvOEES_
_ZZaSFvOEES_ _ZZaSFvOEES_
# Could crash
_ZZeqFvOEES_z
_ZZeqFvOEES_z
# #
# demangler/80513 Test for bogus characters after __thunk_ # demangler/80513 Test for bogus characters after __thunk_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment