zsh-users
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: GoTaR <gotar@poczta.onet.pl>
Cc: zsh-users@sunsite.dk
Subject: Re: 4.1.1: three bugs?
Date: Tue, 29 Jul 2003 02:51:11 -0700	[thread overview]
Message-ID: <20030729095111.GB12603@binome.blorf.net> (raw)
In-Reply-To: <20030729074554.GA1327@os>

On Tue, Jul 29, 2003 at 09:45:54AM +0200, GoTaR wrote:
> ~: zsh
> ~: slfj zxc ewtg lkjlk
>             ^move cursor here and press alt-d

A second (separate) word-delete is needed to get the code to fail, so
I typed ctrl-y, alt-b, alt-d after this.

> ~: slfj zxc  lkjlk
>                   ^move cursor here and press twice alt-y
> ~: slfj zxc  lkjlkzsh: segmentation fault  zsh

Cause: the first alt-y is considered a yank command, even though it
fails.  Thus, the second alt-y can slip by the sanity check at the start
of the yankpop() function, and if "kctbuf" is NULL (as it is if there
was no ctrl-y ever performed), zsh crashes.

The following patch fixes this:

--- Src/Zle/zle_misc.c	27 Feb 2003 11:32:53 -0000	1.8
+++ Src/Zle/zle_misc.c	29 Jul 2003 09:36:12 -0000
@@ -372,8 +372,10 @@
     int cc, kctstart = kct;
     Cutbuffer buf;
 
-    if (!(lastcmd & ZLE_YANK) || !kring)
+    if (!(lastcmd & ZLE_YANK) || !kring || !kctbuf) {
+	kctbuf = NULL;
 	return 1;
+    }
     do {
 	/*
 	 * This is supposed to make the yankpop loop

Setting kctbuf to NULL on failure prevents the user from getting a
yanked value out of two consecutive alt-y keystrokes in the case where a
ctrl-y was performed at some point in the past (but not immediately
prior to the alt-y).

I'll commit this to CVS.

..wayne..


  reply	other threads:[~2003-07-29  9:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-29  7:45 GoTaR
2003-07-29  9:51 ` Wayne Davison [this message]
2003-07-29 10:01   ` Wayne Davison

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=20030729095111.GB12603@binome.blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=gotar@poczta.onet.pl \
    --cc=zsh-users@sunsite.dk \
    /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).