zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <psprint@zdharma.org>
To: zsh-workers@zsh.org
Subject: [BUG] Segfault if zcompile followed by source, on large file
Date: Tue, 2 Jan 2018 15:49:22 +0100	[thread overview]
Message-ID: <etPan.5a4b9bf3.5f062768.13d7@zdharma.org> (raw)

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


             reply	other threads:[~2018-01-02 14:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180102145007epcas2p35349fe256ab195853ed923c0f84f900b@epcas2p3.samsung.com>
2018-01-02 14:49 ` Sebastian Gniazdowski [this message]
2018-01-02 15:26   ` Daniel Shahaf
2018-01-03  6:40   ` Sebastian Gniazdowski
2018-01-05 10:23   ` Peter Stephenson
2018-01-05 22:40     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=etPan.5a4b9bf3.5f062768.13d7@zdharma.org \
    --to=psprint@zdharma.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).