Fix a stack exhaustion bug in libiberty's demangler when decoding a pathalogically...
authorNick Clifton <nickc@redhat.com>
Wed, 10 Apr 2019 14:44:47 +0000 (14:44 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Wed, 10 Apr 2019 14:44:47 +0000 (14:44 +0000)
commit6fe6bd7c0860961bfa4a705974bce6b9ec31edeb
treeffe13bde53d3a688b5321c1af99e90eaa4decf14
parent07c2fa4665510267112030d500d7b1b7c0f4364e
Fix a stack exhaustion bug in libiberty's demangler when decoding a pathalogically constructed mangled name.

PR 89394
* cp-demangle.c (cplus_demangle_fill_name): Reject negative
lengths.
(d_count_templates_scopes): Replace num_templates and num_scopes
parameters with a struct d_print_info pointer parameter.  Adjust
body of the function accordingly.  Add recursion counter and check
that the recursion limit is not reached.
(d_print_init): Pass dpi parameter to d_count_templates_scopes.
Reset recursion counter afterwards, unless the recursion limit was
reached.

From-SVN: r270258
libiberty/ChangeLog
libiberty/cp-demangle.c