Re: [BUG] stack-overflow in src/parser.c

Shivang Upadhyay <[email protected]> Mon, 1 Jun 2026 19:26:22 +0530
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
On Wed, Mar 18, 2026 at 02:12:02PM +0300, Ilia Kashintsev wrote:
> 
> The stacktrace itself is not always consistent, f.e. sometimes the
> crash occurs upon entering command() on line 321 or inside of
> xxreadtoken() on line 810.
> 
> Steps to reproduce:
> 
> export CC=clang
> export CFLAGS=" -g -fsanitize=address "
> ./autogen.sh
> ./configure
> make
> #80000 might be excessive, even 10000 is enough for ulimit -s 8192
> printf '%0.s(' {1..80000} > brackets.txt
> ./src/dash -i brackets.txt


Hi Ilia, Maintainers,

I have a small fix for this bug, which is more direct. setting a
recurse limit of '(' and '{'. I think 5000 should be fine. Although
there can be a more proper fix using user m-allocated stack. But
I am not sure how to implement that.

I'll send the patch as a reply to this message.

Thanks.
~Shivang