bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Large compound commands resulting in a segfault


From:
Subject: Large compound commands resulting in a segfault
Date: Fri, 21 Jun 2019 20:22:46 +0100

Hi, 

The following script generates a compound command consisting of many instances 
of the : command. I have found that it reproducibly induces a segfault in all 
versions of bash from 2 onwards. I tested various other shells - several more 
than are implied here - all of which could handle the generated code without 
issue.

#!/bin/bash
shells=('busybox sh' dash posh ksh mksh bash)
code=$(printf '{ '; printf '%.s:; ' {1..50000}; printf '}')
for shell in "${shells[@]}"; do
    type "${shell%% *}" &>/dev/null || continue
    echo "testing: $shell"
    echo "$code" | $shell || echo "$shell failed"
done

-- 
Kerin Millar <kfm@plushkava.net>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]