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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270258
138bc75d-0d04-0410-961f-
82ee72b054a4