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: Sat, 4 Jul 2020 13:20:26 -0700	[thread overview]
Message-ID: <CAH+w=7YKTM88-BQFUMoQs_R8QNRd-YxqqVEjmhYsctN9mXeFCg@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7aT+Lf1j5RkdtB5sMdg5QATReh16uTPMg31Bt+z-yxjZQ@mail.gmail.com>

On Sun, Jun 28, 2020 at 8:48 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> So the patch is sort of on the right track, but still not the whole
> story.  Turning this back over to others, I probably won't have a
> chance to look at it again for a few days.

Spent a little while on this today.

This seems to be related to get_comp_string() and the way completion
really wants to remove quotation marks.  E.g.:

% alias a='echo z'<TAB>
% alias a=echo\ zsh

When doing complete-in-word after an open-quote AND there are other
characters on the line that have to be backslash-escaped in order to
remove the quotes, the process of updating the line becomes confused.
For example, starting from:

% alias a="echo foo bar

Complete-in-word after "echo" crashes, and after "foo" produces the
"expect x at offset" debugging message.

It does seem to require the collusion of "compset -q" to actually
crash it.  The recalculation of where words begin and end leads to
mis-indexing.

Again this is as far as I've gotten.  If anyone else wants to have a
go, by all means.

  reply	other threads:[~2020-07-04 20:21 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   ` [BUG] Zsh crashes when using autocomplete because of memory unsafety (double free) Bart Schaefer
2020-06-28 19:27     ` Bart Schaefer
2020-06-28 19:35       ` Bart Schaefer
2020-06-29  3:48         ` Bart Schaefer
2020-07-04 20:20           ` Bart Schaefer [this message]
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=7YKTM88-BQFUMoQs_R8QNRd-YxqqVEjmhYsctN9mXeFCg@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).