Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Zsh parser segmentation fault on taddstr

(please keep me CC'ed, since I'm not subscribed)

Hi all, the following file crashes Zsh when run with noexec:

dualbus@mksh-parser-4pxg:~$ cat -A
if (a)M-^?^@^@<<^EM-^?^I^F|&^D\

dualbus@mksh-parser-4pxg:~$ xxd
00000000: 6966 2028 6129 ff00 003c 3c05 ff09 067c  if (a)...<<....|
00000010: 2604 5c                                  &.\

(gdb) r -nv cmin-zsh-crashes/output_16_crashes_id:000392,sig:11,src:016511+011323,op:splice,rep:2
Starting program: /home/dualbus/zsh/Src/zsh -nv
if (a)�<<�      |&\
Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106     ../sysdeps/x86_64/strlen.S: No such file or directory.
(gdb) bt
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
#1  0x000055555560480c in taddstr (s=0x800006cb54c4 <error: Cannot
access memory at address 0x800006cb54c4>) at text.c:148
#2  0x000055555560698b in gettext2 (state=0x7fffffffdd60) at text.c:949
#3  0x0000555555604f43 in getjobtext (prog=0x7ffff7ff13f8,
c=0x7ffff7ff143c) at text.c:337
#4  0x000055555558c394 in execpline2 (state=0x7fffffffe260, pcode=131,
how=18, input=0, output=0, last1=0) at exec.c:1865
#5  0x000055555558b08a in execpline (state=0x7fffffffe260,
slcode=32770, how=18, last1=0) at exec.c:1602
#6  0x000055555558a39e in execlist (state=0x7fffffffe260,
dont_change_job=0, exiting=0) at exec.c:1360
#7  0x0000555555589a44 in execode (p=0x7ffff7ff13f8,
dont_change_job=0, exiting=0, context=0x55555561a27f "toplevel") at
#8  0x00005555555aeb6b in loop (toplevel=1, justonce=0) at init.c:208
#9  0x00005555555b29bb in zsh_main (argc=3, argv=0x7fffffffe558) at init.c:1692
#10 0x000055555556a320 in main (argc=3, argv=0x7fffffffe558) at ./main.c:93

Bug found by fuzzing `zsh -nv @@' with AFL.

Messages sorted by: Reverse Date, Date, Thread, Author