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

Re: [nicolas.george@xxxxxx: Bug#187259: Zsh: segmentation fault with vared]



Clint Adams wrote:
> ----- Forwarded message from Nicolas George <nicolas.george@xxxxxx> -----
> 
> Date: Wed, 2 Apr 2003 13:24:50 +0200
> From: Nicolas George <nicolas.george@xxxxxx>
> To: submit@xxxxxxxxxxxxxxx
> Subject: Bug#187259: Zsh: segmentation fault with vared
> 
> Package: zsh
> Version: 4.0.6-30
> 
> cigaes@ssecem ~ $ zsh
> cigaes@ssecem ~ $ l=(); vared l
> zsh: segmentation fault  zsh

I think this is the most consistent fix, but if anyone else thinks all
the undocumented calls to the undocumented sepjoin interface require a
non-zalloc'd value in the special case where the array is NULL I can
rethink.  (In case you are in any doubt this is expecting the answer
`no'.)

Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.49
diff -u -r1.49 utils.c
--- Src/utils.c	2 May 2003 10:25:33 -0000	1.49
+++ Src/utils.c	12 May 2003 11:20:14 -0000
@@ -2050,7 +2050,7 @@
     char sepbuf[3];
 
     if (!*s)
-	return "";
+	return heap ? "" : ztrdup("");
     if (!sep) {
 	sep = sepbuf;
 	sepbuf[0] = *ifs;

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