From: Travis Spencer <tspencer@cs.pdx.edu>
To: zsh-workers@sunsite.dk
Subject: PATCH: computil.c segfaults when _values called with too few arguments
Date: Mon, 11 Jul 2005 02:05:02 -0700 [thread overview]
Message-ID: <20050711090502.GF12208@ruby.cat.pdx.edu> (raw)
Given this completion definition:
#compdef testvalues
_arguments "-n:foo bar:_values -s , -S ''"
After entering the `-n' flag and then hitting tab, zsh will segfault
every time as demonstrated in the following typescript:
Script started on Mon Jul 11 01:05:49 2005
murzim% stash/opt/bin/zsh -f
murzim% fpath=( .zsh/functions $fpath )
murzim% autoload compinit
murzim% compinit
murzim% testvalues -n zsh: segmentation fault (core dumped) stash/opt/bin/zsh -f
murzim% exit
script done on Mon Jul 11 01:06:38 2005
Script started on Mon Jul 11 01:54:21 2005
murzim% stash/opt/bin/zsh --version
zsh 4.3.0-dev-1 (sparc-sun-solaris2.9)
murzim% exit
script done on Mon Jul 11 01:54:46 2005
The problem was caused by dereferencing a NULL pointer in parse_cvdef.
Here is a patch to fix the problem.
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.88
diff -u -p -r1.88 computil.c
--- Src/Zle/computil.c 7 Dec 2004 16:55:12 -0000 1.88
+++ Src/Zle/computil.c 11 Jul 2005 08:58:06 -0000
@@ -2660,7 +2660,8 @@ parse_cvdef(char *nam, char **args)
char **oargs = args, sep = '\0', asep = '=', *name, *descr, *p, *q, **xor, c;
int xnum, multi, vtype, hassep = 0, words = 0;
- while (args[0][0] == '-' &&
+ while (args && args[0] && args[1] &&
+ args[0][0] == '-' &&
(args[0][1] == 's' || args[0][1] == 'S' || args[0][1] == 'w') &&
!args[0][2]) {
reply other threads:[~2005-07-11 9:05 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=20050711090502.GF12208@ruby.cat.pdx.edu \
--to=tspencer@cs.pdx.edu \
--cc=zsh-workers@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).