On 1/26/2022 8:29 AM, Nick Clifton via Gcc-patches wrote:
Hi Guys,

   I would like to propose the patch below to fix a couple of sources
   of infinite recursion in libiberty's rust demangling code.  This patch
   is based upon the one submitted for PR 99935, but extended to cope
   with the case presented in PR 98886 and also fixed so that the "uint"
   type is not used.

   Tested with a patched version of the binutils sources on an
   x86-pc-linux-gnu target.

Cheers
   Nick

2022-01-26  Nick Clifton  <ni...@redhat.com>

        * rust-demangle.c (struct rust_demangler): Add a recursion
        counter.
        (demangle_path): Increment/decrement the recursion counter upon
        entry and exit.  Fail if the counter exceeds a fixed limit.
        (demangle_type): Likewise.
        (rust_demangle_callback): Initialise the recursion counter,
        disabling if requested by the option flags.
OK.  I'm both amazed and disappointed at how all the demanglers seem to be prone to infinite recursion.

jeff

Reply via email to