On Sun, Aug 25, 2024, at 6:24 PM, youheng....@gmail.com wrote:
> Bash Version: 5.1
>
> Patch Level: 16

Note that this version of bash is outdated and will not receive
further updates.  The current release is 5.2.


>         All the following scripts can create a Segmentation Fault
>
>         eval '<$[;]'
>         eval '<${;}'
>         eval '<$[|]'

These still cause the current devel branch to segfault, but (at
least for me, on macOS) only when invoked via argument, as OP
directed.  For example, reading the scripts via stdin avoids the
segfault.

        % cat /tmp/poc.bash
        eval '<$[;]'
        % ./bash /tmp/poc.bash
        /tmp/poc.bash: line 1: ;: arithmetic syntax error: operand expected 
(error token is ";")
        /tmp/poc.bash: line 1: 55480 Segmentation fault: 11
        % ./bash </tmp/poc.bash
        ./bash: line 1: ;: arithmetic syntax error: operand expected (error 
token is ";")


>         eval '<$(;)'
>         eval '<$(|)'

Current devel doesn't segfault with these.  Maybe because of the
comsub parser rewrite?


>         eval '<${|}'

Current devel doesn't segfault with this, either.


-- 
vq

Reply via email to