I'm no shell-script master, but this is segfaulting my Bash, and I was
able to reproduce it on a couple different systems (including the #bash
shbot :P):

    echo '_() { exec <&- ;}; _ "$0" "$@"' >bleh.sh
    cat bleh.sh | bash

Same doesn't cause any problems in recent `dash` or `zsh`.

Someone reproducing it for me sent the following trace:

    Core was generated by `/home/dualbus/src/gnu/bash/bash'.
    Program terminated with signal SIGSEGV, Segmentation fault.
    #0  0x000055f7e10e6b2b in buffered_getchar () at input.c:565
    565       return (bufstream_getc
(buffers[bash_input.location.buffered_fd]));
    (gdb) bt
    #0  0x000055f7e10e6b2b in buffered_getchar () at input.c:565
    #1  0x000055f7e109a23a in yy_getc () at
/usr/homes/chet/src/bash/src/parse.y:1390
    #2  0x000055f7e109b12b in shell_getc (remove_quoted_newline=1) at
/usr/homes/chet/src/bash/src/parse.y:2299
    #3  0x000055f7e109c654 in read_token (command=0) at
/usr/homes/chet/src/bash/src/parse.y:3115
    #4  0x000055f7e109bbed in yylex () at
/usr/homes/chet/src/bash/src/parse.y:2675
    #5  0x000055f7e1097251 in yyparse () at y.tab.c:1834
    #6  0x000055f7e1096ecd in parse_command () at eval.c:261
    #7  0x000055f7e1096fb3 in read_command () at eval.c:305
    #8  0x000055f7e1096bf7 in reader_loop () at eval.c:149
    #9  0x000055f7e10947fa in main (argc=1, argv=0x7ffdd7b84f98,
env=0x7ffdd7b84fa8) at shell.c:792


⁓ ELLIOTTCABLE — fly safe.
  http://ell.io/tt

Reply via email to