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

[BUG] Crash when accessing WIDGETSTYLE from SIGINT trap



To reproduce:

1. Type `zsh -df`.
2. Type `trap ': $WIDGETSTYLE; return 130' INT`.
3. Press Ctrl-C.
4. Press Ctrl-C.

    % zsh -df
    adam% trap ': $WIDGETSTYLE; return 130' INT
    adam%
    adam% zsh: segmentation fault (core dumped)  zsh -df

Stack trace:

    #0  get_widgetstyle (pm=0x55d039ec4170) at zle_params.c:436
    #1  0x000055d03838591b in getstrvalue (v=0x7ffc0b0c23b0)
        at params.c:2196
    #2  0x000055d0383b34c5 in paramsubst (l=0x7fa2e862ee48,
        n=0x7fa2e862ee78, str=0x7ffc0b0c2480, qt=0, pf_flags=0,
        ret_flags=0x7ffc0b0c2594) at subst.c:2679
    #3  0x000055d0383ae44a in stringsubst (list=0x7fa2e862ee48,
        node=0x7fa2e862ee78, pf_flags=0, ret_flags=0x7ffc0b0c2594,
        asssub=0) at subst.c:322
    #4  0x000055d0383ad716 in prefork (list=0x7fa2e862ee48,
        flags=0, ret_flags=0x7ffc0b0c2594) at subst.c:142
    #5  0x000055d038338040 in execcmd_exec (state=0x7ffc0b0c2ec0,
        eparams=0x7ffc0b0c2ae0, input=0, output=0, how=2, last1=2,
        close_if_forked=-1) at exec.c:3178
    #6  0x000055d038334a3a in execpline2 (state=0x7ffc0b0c2ec0,
        pcode=131, how=2, input=0, output=0, last1=0) at exec.c:1930
    #7  0x000055d0383335dd in execpline (state=0x7ffc0b0c2ec0,
        slcode=4098, how=2, last1=0) at exec.c:1660
    #8  0x000055d038332880 in execlist (state=0x7ffc0b0c2ec0,
        dont_change_job=1, exiting=0) at exec.c:1415
    #9  0x000055d038331ebc in execode (p=0x55d039eb58f0,
        dont_change_job=1, exiting=0, context=0x55d0383dab37 "trap")
        at exec.c:1194
    #10 0x000055d0383ab02b in dotrapargs (sig=2,
        sigtr=0x55d038604648 <sigtrapped+8>, sigfn=0x55d039eb58f0)
        at signals.c:1381
    #11 0x000055d0383ab5c1 in dotrap (sig=2) at signals.c:1487
    #12 0x000055d0383aac14 in handletrap (sig=2) at signals.c:1202
    #13 0x000055d0383a9423 in zhandler (sig=2) at signals.c:670
    #14 <signal handler called>
    #15 0x00007fa2e7756081 in __GI___libc_read (fd=10,
        buf=0x7ffc0b0c44c3, nbytes=1)
        at ../sysdeps/unix/sysv/linux/read.c:27
    #16 0x00007fa2e5fdaead in raw_getbyte (do_keytmout=0,
        cptr=0x7ffc0b0c44c3 "\347\242\177", full=1)
        at zle_main.c:849
    #17 0x00007fa2e5fdb16e in getbyte (do_keytmout=0, timeout=0x0,
        full=1) at zle_main.c:884
    #18 0x00007fa2e5fd99ce in getkeybuf (w=0) at zle_keymap.c:1676
    #19 0x00007fa2e5fd9776 in getkeymapcmd (km=0x55d039eb81d0,
        funcp=0x7ffc0b0c4630, strp=0x7ffc0b0c4638)
        at zle_keymap.c:1587
    #20 0x00007fa2e5fd9a4c in getkeycmd () at zle_keymap.c:1705
    #21 0x00007fa2e5fdb945 in zlecore () at zle_main.c:1128
    #22 0x00007fa2e5fdc3e9 in zleread (lp=0x55d0385ffe20 <prompt>,
        rp=0x0, flags=3, context=0,
        init=0x7fa2e60065c0 "zle-line-init",
        finish=0x7fa2e60065b0 "zle-line-finish") at zle_main.c:1350
    #23 0x00007fa2e5fdf52b in zle_main_entry (cmd=1,
        ap=0x7ffc0b0c48c0) at zle_main.c:2119
    #24 0x000055d03835d876 in zleentry (cmd=1) at init.c:1616
    #25 0x000055d03835eb8d in inputline () at input.c:295
    #26 0x000055d03835e9d1 in ingetc () at input.c:228
    #27 0x000055d038350945 in ihgetc () at hist.c:408
    #28 0x000055d038368e99 in gettok () at lex.c:611
    #29 0x000055d038368576 in zshlex () at lex.c:275
    #30 0x000055d0383903b0 in parse_event (endtok=37) at parse.c:581
    #31 0x000055d03835995e in loop (toplevel=1, justonce=0)
        at init.c:150
    #32 0x000055d03835dd38 in zsh_main (argc=2, argv=0x7ffc0b0c4d88)
        at init.c:1770
    #33 0x000055d03830f0b7 in main (argc=2, argv=0x7ffc0b0c4d88)
        at ./main.c:93

Crash at zle_params.c:436 due to bindk being null:

    Widget widget = bindk->widget;

Roman.



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