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

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

On Tue, 2 Jan 2018 15:49:22 +0100
Sebastian Gniazdowski <psprint@xxxxxxxxxxx> wrote:
> I noticed that zcompiling a 4.29 MiB source and then sourcing it
> causes segfault.
Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> 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

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


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