https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89394

--- Comment #7 from Nick Clifton <nickc at gcc dot gnu.org> ---
Author: nickc
Date: Wed Apr 10 14:44:47 2019
New Revision: 270258

URL: https://gcc.gnu.org/viewcvs?rev=270258&root=gcc&view=rev
Log:
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.

Modified:
    trunk/libiberty/ChangeLog
    trunk/libiberty/cp-demangle.c

Reply via email to