Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Crash with 'print -s' with no further arguments
- X-seq: zsh-workers 18383
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: Miciah Dashiel Butler Masters <miciah@xxxxxxxxxxxxx>
- Subject: PATCH: Crash with 'print -s' with no further arguments
- Date: Tue, 25 Mar 2003 10:03:30 -0800
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <b5bgn6$u8a$1@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <b59211$60n$1@xxxxxxxxxxxxxx> <1030320041539.ZM2167@xxxxxxxxxxxxxxxxxxxxxxx> <b5bgn6$u8a$1@xxxxxxxxxxxxxx>
On Thu, Mar 20, 2003 at 04:40:07AM +0000, Miciah Dashiel Butler Masters wrote:
> $ zsh -f
> AwesomeComp% setopt hist_ignore_all_dups
> AwesomeComp% print -s
> AwesomeComp% print -s
> Segmentation fault
This turns out to be a bug in the zjoin() function when it generates
an empty string and the heap flag is not set. This patch fixes the
problem:
--- Src/utils.c 24 Mar 2003 12:57:25 -0000 1.47
+++ Src/utils.c 25 Mar 2003 17:57:07 -0000
@@ -1793,7 +1793,7 @@
for (s = arr; *s; s++)
len += strlen(*s) + 1;
if (!len)
- return "";
+ return heap? "" : ztrdup("");
ptr = ret = (heap ? (char *) hcalloc(len) : (char *) zcalloc(len));
for (s = arr; *s; s++) {
strucpy(&ptr, *s);
This should also fix any other crash bug that was caused by typing
"print -s" (without any args) -- the only difference is when the code
will try to free the literal "" string.
..wayne..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author