zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: crash completing after ~[]
@ 2008-09-29 17:34 Peter Stephenson
  2008-09-29 20:40 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2008-09-29 17:34 UTC (permalink / raw)
  To: Zsh hackers list

I got the shell to crash when completing (actually an attempted
expansion) after "echo ~[]".  Apart from the suggestive command line,
this is actually unrelated to dynamic named directories.  The expansion
not surprising doesn't succeed anyway, so I haven't worried too much
(or at all) about what the shell code is doing that provokes this; it
appears to be an invalid pattern in a search through an associative
array, which is indeed not properly handled at this point.

Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.146
diff -u -r1.146 params.c
--- Src/params.c	13 Sep 2008 08:19:19 -0000	1.146
+++ Src/params.c	29 Sep 2008 17:29:49 -0000
@@ -1302,6 +1302,8 @@
 
 	if (v->isarr) {
 	    if (ishash) {
+		if (!pprog)
+		    return 1;
 		scanprog = pprog;
 		scanstr = s;
 		if (keymatch)

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: crash completing after ~[]
  2008-09-29 17:34 PATCH: crash completing after ~[] Peter Stephenson
@ 2008-09-29 20:40 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2008-09-29 20:40 UTC (permalink / raw)
  To: Zsh hackers list

On Mon, 29 Sep 2008 18:34:27 +0100
Peter Stephenson <pws@csr.com> wrote:
> Index: Src/params.c
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Src/params.c,v
> retrieving revision 1.146
> diff -u -r1.146 params.c
> --- Src/params.c	13 Sep 2008 08:19:19 -0000	1.146
> +++ Src/params.c	29 Sep 2008 17:29:49 -0000
> @@ -1302,6 +1302,8 @@
>  
>  	if (v->isarr) {
>  	    if (ishash) {
> +		if (!pprog)
> +		    return 1;
>  		scanprog = pprog;
>  		scanstr = s;
>  		if (keymatch)

Oops.  pprog should be NULL in some cases.

Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.147
diff -u -r1.147 params.c
--- Src/params.c	29 Sep 2008 17:39:39 -0000	1.147
+++ Src/params.c	29 Sep 2008 20:40:20 -0000
@@ -1302,16 +1302,18 @@
 
 	if (v->isarr) {
 	    if (ishash) {
-		if (!pprog)
-		    return 1;
 		scanprog = pprog;
 		scanstr = s;
 		if (keymatch)
 		    v->isarr |= SCANPM_KEYMATCH;
-		else if (ind)
-		    v->isarr |= SCANPM_MATCHKEY;
-		else
-		    v->isarr |= SCANPM_MATCHVAL;
+		else {
+		    if (!pprog)
+			return 1;
+		    if (ind)
+			v->isarr |= SCANPM_MATCHKEY;
+		    else
+			v->isarr |= SCANPM_MATCHVAL;
+		}
 		if (down)
 		    v->isarr |= SCANPM_MATCHMANY;
 		if ((ta = getvaluearr(v)) &&


-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-29 20:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-29 17:34 PATCH: crash completing after ~[] Peter Stephenson
2008-09-29 20:40 ` Peter Stephenson

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