* PATCH: computil.c segfaults when _values called with too few arguments
@ 2005-07-11 9:05 Travis Spencer
0 siblings, 0 replies; only message in thread
From: Travis Spencer @ 2005-07-11 9:05 UTC (permalink / raw)
To: zsh-workers
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]) {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-07-11 9:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-11 9:05 PATCH: computil.c segfaults when _values called with too few arguments Travis Spencer
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).