zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [BUG] Zsh crashes when using autocomplete because of memory unsafety (double free)
Date: Sun, 28 Jun 2020 00:09:02 -0700	[thread overview]
Message-ID: <CAH+w=7YVxqB5-TSO8QNvJajjv_MxnmWijd9PX=wkzXNu-GKGmg@mail.gmail.com> (raw)
In-Reply-To: <20200626162405.4a7d28c1@tarpaulin.shahaf.local2>

[-- Attachment #1: Type: text/plain, Size: 926 bytes --]

On Fri, Jun 26, 2020 at 9:24 AM Daniel Shahaf <d.s@daniel.shahaf.name>
wrote:

>
> tl;dr: I can reproduce two different segfaults here: one of them with
> a minimal reproduction recipe; one with my personal setup, and
> a specific setopt makes it go away.
>

Even more minimal:

% autoload compinit
% compinit -D
% setopt completeinword
% alias a='"<left><TAB>

I think it has to do with
compset -P 1 '*='
compset -q

If you look at what happens with

% alias a='<TAB>
% alias a=

Alternately,

% alias a='"<TAB>
% alias a=\"

So, what's happening is that a=' turns into a=\" and consequently increases
the offset by one, but then when completion fails (because of the
double-quote not matching anything to the right of the cursor) and the
original command line is restored, the new larger offset is applied to the
original a=' string and indexes off the left end.

Having gotten that far, though, I don't know how to fix it.

  parent reply	other threads:[~2020-06-28  7:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-26 15:03 Petr Šťastný
2020-06-26 16:24 ` Daniel Shahaf
2020-06-26 16:32   ` Roman Perepelitsa
2020-06-26 17:17     ` zsh/lldb (was: Re: [BUG] Zsh crashes when using autocomplete because of memory unsafety (double free)) Daniel Shahaf
2020-06-28  7:09   ` Bart Schaefer [this message]
2020-06-28 19:27     ` [BUG] Zsh crashes when using autocomplete because of memory unsafety (double free) Bart Schaefer
2020-06-28 19:35       ` Bart Schaefer
2020-06-29  3:48         ` Bart Schaefer
2020-07-04 20:20           ` Bart Schaefer
2020-06-27 21:08 Petr Šťastný

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='CAH+w=7YVxqB5-TSO8QNvJajjv_MxnmWijd9PX=wkzXNu-GKGmg@mail.gmail.com' \
    --to=schaefer@brasslantern.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).