This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA/RFC: Add stack recursion limit to libiberty's demangler [v3]


On 11/30/2018 05:41 PM, Nick Clifton wrote:
> @@ -4693,10 +4694,21 @@
>  demangle_nested_args (struct work_stuff *work, const char **mangled,
>                        string *declp)
>  {
> +  static unsigned long recursion_level = 0;
>    string* saved_previous_argument;
>    int result;
>    int saved_nrepeats;
>  
> +  if ((work->options & DMGL_RECURSE_LIMIT)
> +      && work->recursion_level > DEMANGLE_RECURSION_LIMIT)
> +    {
> +      /* FIXME: There ought to be a way to report that the recursion limit
> +	 has been reached.  */
> +      return 0;
> +    }
> +
> +  recursion_level ++;
> +

There's still a static recursion level counter here?

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]