zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: core dump in vichange()
Date: Thu, 13 Mar 2014 21:31:59 +0900	[thread overview]
Message-ID: <83FCB166-FC90-4A7A-80A2-6A0420FFA87A@kba.biglobe.ne.jp> (raw)

The following causes a core dump in function vichange():

$ zsh -f
$ bindkey -v
$ echo foo
$ <ESC>kcw

k=up-line-or-history, c=vi-change, w=vi-forward-word
(or 'kc' followed by any motion command)

The core dump is at line 404 of zle_vi.c:
        vistartchange = curchange->prev->changeno;
with curchange->prev == NULL.


diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 994b44f..9e39143 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -401,7 +401,7 @@ vichange(UNUSED(char **args))
 	forekill(c2 - zlecs, CUT_RAW);
 	selectkeymap("main", 1);
 	viinsbegin = zlecs;
-	vistartchange = curchange->prev->changeno;
+	vistartchange = (curchange && curchange->prev) ? curchange->prev->changeno : 0;
     }
     return ret;
 }



                 reply	other threads:[~2014-03-13 13:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=83FCB166-FC90-4A7A-80A2-6A0420FFA87A@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --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).