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

[BUG] Segfault if zcompile followed by source, on large file



Hello
I noticed that zcompiling a 4.29 MiB source and then sourcing it causes segfault. The file is: https://github.com/zdharma/hacking-private/blob/master/eval-room/srctest.zsh. It contains only assigns.

Restarting shell and sourcing the already compiled file – no segfault. Ran bt in lldb:

  * frame #0: 0x00000001090d6c3a zsh-5.4.2-dev-0`addvars(state=0x00007fff56b3d290, pc=<unavailable>, addflags=<unavailable>) + 1482 at exec.c:2435
    frame #1: 0x00000001090d2785 zsh-5.4.2-dev-0`execsimple(state=0x00007fff56b3d290) + 245 at exec.c:1209

The code:

(lldb) down
frame #0: 0x00000001090d6c3a zsh-5.4.2-dev-0`addvars(state=0x00007fff56b3d290, pc=<unavailable>, addflags=<unavailable>) + 1482 at exec.c:2435
   2432		doneps4 = 1;
   2433	    }
   2434	    state->pc = pc;
-> 2435	    while (wc_code(ac = *state->pc++) == WC_ASSIGN) {
   2436		int myflags = flags;
   2437		name = ecgetstr(state, EC_DUPTOK, &htok);
   2438		if (htok)

A dubious try to narrow a cause:

(lldb) p *state->pc
error: Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory

I exponentially enlarged the file starting from 1 line, and first segfault occurred at 292k lines, 146k was fine.

--  
Sebastian Gniazdowski
psprint /at/ zdharma.org



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