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

Re: segfault in 4.1.1-test-2 [now with a different param expansion]

Anthony Heading wrote:
> I'm probably missing something obvious here - At the point of the fault,
> parameter 'a' of nstrpcmp is null, however it looks to me like it's
> outside the range of the qsort??!

Aha, that's because you don't appreciate the power of zsh's
NoCommentNeeded(TM) Technology.

There was a subtle error in the comparison function which could result
in fairly arbitrary unpleasantness.

Index: Src/subst.c
RCS file: /cvsroot/zsh/zsh/Src/subst.c,v
retrieving revision 1.33
diff -u -r1.33 subst.c
--- Src/subst.c	21 May 2003 16:21:01 -0000	1.33
+++ Src/subst.c	22 May 2003 10:05:05 -0000
@@ -554,7 +554,7 @@
     cmp = (int)STOUC(*c) - (int)STOUC(*d);
     if (idigit(*c) || idigit(*d)) {
-	for (; c > *(char **)b && idigit(c[-1]); c--, d--);
+	for (; c > *(char **)a && idigit(c[-1]); c--, d--);
 	if (idigit(*c) && idigit(*d)) {
 	    while (*c == '0')

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

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