zsh-workers
 help / color / mirror / code / Atom feed
* core dump in vichange()
@ 2014-03-13 12:31 Jun T.
  0 siblings, 0 replies; only message in thread
From: Jun T. @ 2014-03-13 12:31 UTC (permalink / raw)
  To: zsh-workers

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;
 }



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-13 13:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-13 12:31 core dump in vichange() Jun T.

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).