* Sigsegv on empty array intersection/subtraction
@ 2013-11-16 21:48 Charles Daffern
2013-11-17 8:59 ` Bart Schaefer
2013-11-17 20:01 ` Peter Stephenson
0 siblings, 2 replies; 3+ messages in thread
From: Charles Daffern @ 2013-11-16 21:48 UTC (permalink / raw)
To: zsh-workers
${:*}
${:|}
The missing first parameter in these expressions causes a segmentation
fault. I'm using zsh 5.0.2 (x86_64-unknown-linux-gnu).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Sigsegv on empty array intersection/subtraction
2013-11-16 21:48 Sigsegv on empty array intersection/subtraction Charles Daffern
@ 2013-11-17 8:59 ` Bart Schaefer
2013-11-17 20:01 ` Peter Stephenson
1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2013-11-17 8:59 UTC (permalink / raw)
To: Charles Daffern, zsh-workers
On Nov 16, 9:48pm, Charles Daffern wrote:
} Subject: Sigsegv on empty array intersection/subtraction
}
} ${:*}
} ${:|}
I don't get a crash, but I do get
../../zsh-5.0/Src/subst.c:3712: value is NULL in paramsubst
Is it possible this crash has already been fixed by workers/30993?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Sigsegv on empty array intersection/subtraction
2013-11-16 21:48 Sigsegv on empty array intersection/subtraction Charles Daffern
2013-11-17 8:59 ` Bart Schaefer
@ 2013-11-17 20:01 ` Peter Stephenson
1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2013-11-17 20:01 UTC (permalink / raw)
To: zsh-workers
On Sat, 16 Nov 2013 21:48:26 +0000
Charles Daffern <seejay.11@gmail.com> wrote:
> ${:*}
> ${:|}
>
> The missing first parameter in these expressions causes a segmentation
> fault. I'm using zsh 5.0.2 (x86_64-unknown-linux-gnu).
The following repeats a chunk in the other branch of the "if", but there
isn't an obvious common place to put it without the risk of subtle
changes of behaviour.
diff --git a/Src/subst.c b/Src/subst.c
index a4df256..1059508 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2941,6 +2941,14 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
}
}
}
+ if (vunset) {
+ if (unset(UNSET)) {
+ *idend = '\0';
+ zerr("%s: parameter not set", idbeg);
+ return NULL;
+ }
+ val = dupstring("");
+ }
} else { /* no ${...=...} or anything, but possible modifiers. */
/*
* Handler ${+...}. TODO: strange, why do we handle this only
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index bea9459..f72a3d6 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1551,3 +1551,12 @@
0:Empty parameter shouldn't cause modifiers to crash the shell
>
>
+
+# This used to cause uncontrolled behaviour, but at best
+# you got the wrong output so the check is worth it.
+ args() { print $#; }
+ args ${:*}
+ args ${:|}
+0:Intersection and disjunction with empty parameters
+>0
+>0
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-17 20:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-16 21:48 Sigsegv on empty array intersection/subtraction Charles Daffern
2013-11-17 8:59 ` Bart Schaefer
2013-11-17 20:01 ` Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).