Re: [PATCH] parser: set recursion deapth limit for parens

Herbert Xu <[email protected]> Sat, 13 Jun 2026 08:56:01 +0800
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
Shivang Upadhyay <[email protected]> wrote:
> Setting 5000 as limit for recursive parenthesis '()'
> or braces '{}'.
> 
> Signed-off-by: Shivang Upadhyay <[email protected]>
> ---
> src/parser.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
> 
> diff --git a/src/parser.c b/src/parser.c
> index 412e876..5198dc4 100644
> --- a/src/parser.c
> +++ b/src/parser.c
> @@ -110,7 +110,9 @@ struct nodelist *backquotelist;
> union node *redirnode;
> struct heredoc *heredoc;
> int quoteflag;                 /* set if (part of) last token was quoted */
> +static int paren_depth;                /* track parenthesis nesting depth */
> 
> +#define MAX_PAREN_DEPTH 5000

This is a completely arbitrary limit and removes the ability to
increase recursion by setting ulimit -s.

I'm not taking this.

Thanks,
-- 
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt