]> git.ipfire.org Git - thirdparty/gcc.git/commit - libiberty/cp-demangle.c
Fix a stack exhaustion bug in libiberty's demangler when decoding a pathalogically...
authornickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Apr 2019 14:44:47 +0000 (14:44 +0000)
committernickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Apr 2019 14:44:47 +0000 (14:44 +0000)
commitccd474323d2c27448760c67fb2614a3452896e2a
treeffe13bde53d3a688b5321c1af99e90eaa4decf14
parentc6b644142a7856e7ff1a40b46d83d722748ef2be
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
libiberty/ChangeLog
libiberty/cp-demangle.c