mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 22:11:54 +02:00
30993: fix parameter modifier crash with :wq on empty string
This commit is contained in:
parent
27c5a0d774
commit
44757a653c
3 changed files with 23 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2013-01-22 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 30993: Src/subst.c, Test/D04parameter.ztst: parameter
|
||||
modifiers :wq operating on an empty string crashed the shell.
|
||||
The shell isn't supposed to crash.
|
||||
|
||||
2013-01-20 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 30987: Completion/X/Command/_xrandr: only call xrandr when
|
||||
|
@ -455,5 +461,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5787 $
|
||||
* $Revision: 1.5788 $
|
||||
*****************************************************
|
||||
|
|
10
Src/subst.c
10
Src/subst.c
|
@ -3707,6 +3707,11 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
|
|||
char *y;
|
||||
|
||||
x = val;
|
||||
if (!x) {
|
||||
/* Shouldn't have got here with a NULL string. */
|
||||
DPUTS(1, "value is NULL in paramsubst");
|
||||
return NULL;
|
||||
}
|
||||
if (prenum || postnum)
|
||||
x = dopadding(x, prenum, postnum, preone, postone,
|
||||
premul, postmul
|
||||
|
@ -4021,7 +4026,10 @@ modify(char **str, char **ptr)
|
|||
all = tmp;
|
||||
t = e;
|
||||
}
|
||||
*str = all;
|
||||
if (!all)
|
||||
*str = dupstring("");
|
||||
else
|
||||
*str = all;
|
||||
|
||||
} else {
|
||||
switch (c) {
|
||||
|
|
|
@ -1544,3 +1544,10 @@
|
|||
0:Regression test for shwordsplit with null or unset IFS and quoted array
|
||||
>abc
|
||||
>a b c
|
||||
|
||||
foo=
|
||||
print ${foo:wq}
|
||||
print ${:wq}
|
||||
0:Empty parameter shouldn't cause modifiers to crash the shell
|
||||
>
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue