Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: segfaults in 4.0.2
- X-seq: zsh-workers 15869
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: segfaults in 4.0.2
- Date: Tue, 25 Sep 2001 14:48:35 +0200
- In-reply-to: <15280.29564.199223.966604@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <yu966au5zyv.fsf@xxxxxxxxxxxxxxxxx> <010907170335.ZM18221@xxxxxxxxxxxxxxxxxxxxxxx> <20010908015928.A21707@xxxxxxxx> <1010908070005.ZM18696@xxxxxxxxxxxxxxxxxxxxxxx> <20010908113425.A27879@xxxxxxxx> <1010908184745.ZM19990@xxxxxxxxxxxxxxxxxxxxxxx> <15280.29564.199223.966604@xxxxxxxxxxxxxxxxxx>
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