Re: bash core dumps doing glob pattern on long string
From:
Martin D Kealey
Subject:
Re: bash core dumps doing glob pattern on long string
Date:
Tue, 11 Oct 2022 15:23:07 +1000
On Sun, 9 Oct 2022 at 18:07, Phi Debian <phi.debian@gmail.com> wrote:
> I was looking at a bug on ksh93 that is "core dumps doing glob pattern on
> long string" and it happen that bash
> suffer the same.
>
> $ [[ $(printf '%0100000d' 0) == +(0) ]]
>
> I see 3 way of fixing this
>
> 1) [...] string should be limited to PATH_MAX [...]
> 2) [...] have a fix recursion deep level [...]
> 3) [...] Implement a stack deep check in the recursion [...]
4) compile globs into state machines, the same way that regexes get
compiled, so that they can be matched without needing any recursion.
-Martin