Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Segfault in echoti with Cs and Ms caps
- X-seq: zsh-workers 52991
- From: "Ronan Pigott" <ronan@xxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Segfault in echoti with Cs and Ms caps
- Date: Tue, 16 Jul 2024 19:53:55 +0000
- Archived-at: <https://zsh.org/workers/52991>
- List-id: <zsh-workers.zsh.org>
- Tls-required: No
Hi zsh-workers,
The following reproduces a segfault in zsh when the Cs or Ms terminfo
capabilities are defined. These caps take 1 and 2 string parameters
respectively, but are not special cased in echoti like the others:
$ print -rl Cs=${terminfo[Cs]//$'\e'/\\E} Ms=${terminfo[Ms]//$'\e'/\\E}
Cs=\E]12;%p1%s\E\
Ms=\E]52;%p1%s;%p2%s\E\
$ echoti Cs 1 # SIGSEGV
$ echoti Ms 1 # SIGSEGV
$ cat gdb.txt # echoti Ms 1
#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
#1 0x000074550cb6ed20 in tparam_internal (tps=0x62a5e7e69090, string=0x62a5e7e6b8ec "\033]52;%p1%s;%p2%s\033\\", data=0x7ffc4a5e3960) at ../ncurses/./tinfo/lib_tparm.c:853
#2 tparm (string=string@entry=0x62a5e7e6b8ec "\033]52;%p1%s;%p2%s\033\\") at ../ncurses/./tinfo/lib_tparm.c:1178
#3 0x000074550cbce36c in bin_echoti (name=<optimized out>, argv=0x74550cbdabd8, ops=<optimized out>, func=<optimized out>) at /usr/src/debug/zsh/zsh-5.9/Src/Modules/terminfo.c:123
#4 0x000062a5b8baa163 in execbuiltin (args=<optimized out>, assigns=0x0, bn=<optimized out>) at /usr/src/debug/zsh/zsh-5.9/Src/builtin.c:506
#5 0x000062a5b8bd17e6 in execcmd_exec (state=state@entry=0x7ffc4a5e5550, eparams=eparams@entry=0x7ffc4a5e5060, input=input@entry=0, output=output@entry=0, how=<optimized out>, how@entry=18, last1=<optimized out>, last1@entry=2, close_if_forked=<optimized out>) at /usr/src/debug/zsh/zsh-5.9/Src/exec.c:4148
#6 0x000062a5b8bd22cf in execpline2 (state=state@entry=0x7ffc4a5e5550, pcode=pcode@entry=8067, how=how@entry=18, input=0, output=0, last1=last1@entry=0) at /usr/src/debug/zsh/zsh-5.9/Src/exec.c:1960
#7 0x000062a5b8bd2714 in execpline (state=state@entry=0x7ffc4a5e5550, slcode=<optimized out>, how=how@entry=18, last1=last1@entry=0) at /usr/src/debug/zsh/zsh-5.9/Src/exec.c:1689
#8 0x000062a5b8bd4646 in execlist (state=state@entry=0x7ffc4a5e5550, dont_change_job=dont_change_job@entry=0, exiting=exiting@entry=0) at /usr/src/debug/zsh/zsh-5.9/Src/exec.c:1444
#9 0x000062a5b8bd4e3e in execode (p=0x74550cbda7e8, dont_change_job=0, exiting=0, context=0x62a5b8c5f43e "toplevel") at /usr/src/debug/zsh/zsh-5.9/Src/exec.c:1221
#10 0x000062a5b8bf32af in loop (toplevel=toplevel@entry=1, justonce=justonce@entry=0) at /usr/src/debug/zsh/zsh-5.9/Src/init.c:212
#11 0x000062a5b8bfae05 in zsh_main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/zsh/zsh-5.9/Src/init.c:1794
#12 0x000062a5b8ba90de in main (argc=<optimized out>, argv=<optimized out>) at ./main.c:93
Cheers,
Ronan
Messages sorted by:
Reverse Date,
Date,
Thread,
Author