]> git.ipfire.org Git - thirdparty/gcc.git/commit
Add a recursion limit to libiberty's demangling code. The limit is enabled by defaul...
authornickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Dec 2018 10:33:30 +0000 (10:33 +0000)
committernickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Dec 2018 10:33:30 +0000 (10:33 +0000)
commit03e51746ed98d9106803f6009ebd71ea670ad3b9
treec7a769006e35e7c23d19c5fd82c84defb575f8bd
parent96fdb9d4a45d32d116aa4fd0042a479db9f2b82d
Add a recursion limit to libiberty's demangling code.  The limit is enabled by default, but can be disabled via a new demangling option.

include * demangle.h (DMGL_NO_RECURSE_LIMIT): Define.
        (DEMANGLE_RECURSION_LIMIT): Define

PR 87681
PR 87675
PR 87636
PR 87350
PR 87335
libiberty * cp-demangle.h (struct d_info): Add recursion_level field.
* cp-demangle.c (d_function_type): Add recursion counter.
If the recursion limit is reached and the check is not disabled,
then return with a failure result.
(cplus_demangle_init_info): Initialise the recursion_level field.
        (d_demangle_callback): If the recursion limit is enabled, check
for a mangled string that is so long that there is not enough
stack space for the local arrays.
        * cplus-dem.c (struct work): Add recursion_level field.
(squangle_mop_up): Set the numb and numk fields to zero.
(work_stuff_copy_to_from): Handle the case where a btypevec or
ktypevec field is NULL.
(demangle_nested_args): Add recursion counter.  If
the recursion limit is not disabled and reached, return with a
failure result.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266886 138bc75d-0d04-0410-961f-82ee72b054a4
include/ChangeLog
include/demangle.h
libiberty/ChangeLog
libiberty/cp-demangle.c
libiberty/cp-demangle.h
libiberty/cplus-dem.c