Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14210

Sequence Brace Expansion Crash

From Thomas Fischer <tjfischer98@gmail.com>
Newsgroups gnu.bash.bug
Subject Sequence Brace Expansion Crash
Date 2018-06-02 21:18 -0700
Message-ID <mailman.1045.1528032062.1292.bug-bash@gnu.org> (permalink)

Show all headers | View raw


From: thomas
To: bug-bash@gnu.org
Subject: Sequence Brace Expansion Crash

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_FORTIFY_SOURCE=2
-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc'
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS
-Wno-parentheses -Wno-format-security
uname output: Linux archlinux 4.16.13-1-ARCH #1 SMP PREEMPT Thu May 31
23:29:29 UTC 2018 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.4
Patch Level: 19
Release Status: release

Description:
I was testing brace expansion, and found that if bash uses too much memory
during the expansion, it will simply be killed.

Repeat-By:
echo {a..z}{a..z}{a..z}{a..z}{a..z}{a..z}

Amusingly, this is the only command I've used that has actually caused a
swap.


Fix:
There should probably be a check somewhere, so that when too much memory is
used, an error is thrown rather than crashing. Or computing the
permutations of the expansion and exiting before the calculation might work.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Sequence Brace Expansion Crash Thomas Fischer <tjfischer98@gmail.com> - 2018-06-02 21:18 -0700

csiph-web