Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: segfaults in 4.0.2



I wrote:

> ...
> 
> I couldn't make it crash, but I can see the problem: it's that empty
> sublist, which the code in text.c wasn't able to handle (it made it
> effectively look one code too far ahead).  The code in exec.c has an
> extra test for that, so I've just (more or less) copied it from there.

Ouch, no, that was a bit too simple because of possible simplified
sublists.


Bye
  Sven

Index: Src/text.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/text.c,v
retrieving revision 1.8
diff -u -r1.8 text.c
--- Src/text.c	2001/09/25 12:10:05	1.8
+++ Src/text.c	2001/09/25 12:44:13
@@ -274,8 +274,9 @@
 	    break;
 	case WC_SUBLIST:
 	    if (!s) {
-                if (wc_code(*state->pc) != WC_PIPE)
-                    stack = 1;
+                if (!(WC_SUBLIST_FLAGS(code) & WC_SUBLIST_SIMPLE) &&
+                    wc_code(*state->pc) != WC_PIPE)
+                    stack = -1;
 		if (WC_SUBLIST_FLAGS(code) & WC_SUBLIST_NOT)
 		    taddstr(stack ? "!" : "! ");
 		if (WC_SUBLIST_FLAGS(code) & WC_SUBLIST_COPROC)
@@ -293,7 +294,7 @@
 			taddstr("coproc ");
 		}
 	    }
-	    if (!stack && (WC_SUBLIST_FLAGS(s->code) & WC_SUBLIST_SIMPLE))
+	    if (stack < 1 && (WC_SUBLIST_FLAGS(s->code) & WC_SUBLIST_SIMPLE))
 		state->pc++;
 	    break;
 	case WC_PIPE:

-- 
Sven Wischnowsky                    wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author