zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: [BUG] Segfault if zcompile followed by source, on large file
Date: Fri, 05 Jan 2018 10:23:18 +0000	[thread overview]
Message-ID: <20180105102318.492dfa5e@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <etPan.5a4b9bf3.5f062768.13d7@zdharma.org>

On Tue, 2 Jan 2018 15:49:22 +0100
Sebastian Gniazdowski <psprint@zdharma.org> wrote:
> I noticed that zcompiling a 4.29 MiB source and then sourcing it
> causes segfault.
>
Daniel Shahaf <d.s@daniel.shahaf.name> wrote
> For the archives, that file contains the output of `repeat 300000 echo
> "a=1; b=2; c=3;"`.

I don't think anyone now understands quite how this works, but the
failure comes the first time prog->strs is referred to.  Short strings
are hidden within the word code itself, so prog->strs is only used
for long strings.  It's not clear that should actually be needed here
with the assignments in question.

In any case, tracking through check_dump_file suggests that prog->strs
is empty --- at least, it's being set to point to the end of the valid
mapped ragne, so accessing it at all is invalid.  That may mean
the compiler (which I haven't walked through) also thought it wasn't
needed.

I suspect it's simply that this file is too long for word code
compilation, as word code has intrinisic limits on valid says based
around 32-bit values, with some bits taken away for special encoding so
you don't necessarily get the full range.  However, there are no checks
internally.

pws


  parent reply	other threads:[~2018-01-05 10:23 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
2018-01-02 15:26   ` Daniel Shahaf
2018-01-03  6:40   ` Sebastian Gniazdowski
2018-01-05 10:23   ` Peter Stephenson [this message]
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=20180105102318.492dfa5e@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --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).