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

Re: segfault via completion menu



On Tue, 2019-05-21 at 15:19 -0700, Bart Schaefer wrote:
> On Tue, May 21, 2019 at 2:59 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> If an error occurs as a result of NEWHEAPS()/OLDHEAPS() in the context
> of workers/36853, it ought to be traceable to something leaking
> heap-allocated storage across boundaries, and probably means there was
> a memory leak when interrupting a pattern match before, which this has
> turned into an error by freeing the previously leaked space.

This is really just saying the same thing a different way, but ---
the original crash was in patmatch() when looking at the pattern code,
which is set up when we compile a pattern in a different
function.  So there's probably some path where it's possible not to
recompile a pattern or reuse a pattern without recompiling, or simply
hang on to it too long.

It'll be something in the prog passed into pattry() from evalcond() and
I'm guesing in this case the pprog in that function came from
stat->prog->pats[npat] so was fished out of the existing programme
rather than compiled locally.

In general (and fairly obviously), anything stored long term in compiled
code is in permanent (i.e. explicitly freed) storage and if the value is
on the heap it should only have been parsed or copied from permanent
storage for immediate use.

pws



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