mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-09-25 05:27:12 +02:00
44345: fix wordcode traversal where ! without a following command could result in a crash
This commit is contained in:
parent
3de2333b08
commit
a531a1ec2d
@ -1,3 +1,8 @@
|
||||
2019-05-23 Oliver Kiddle <okiddle@yahoo.co.uk>
|
||||
|
||||
* 44345: Src/text.c, Test/A01grammar.ztst: fix wordcode traversal
|
||||
where ! without a following command could result in a crash
|
||||
|
||||
2019-05-20 Oliver Kiddle <okiddle@yahoo.co.uk>
|
||||
|
||||
* 44307: Src/exec.c, Src/init.c, Src/params.c, Src/utils.c:
|
||||
|
@ -470,8 +470,13 @@ gettext2(Estate state)
|
||||
" || " : " && ");
|
||||
s->code = *state->pc++;
|
||||
s->pop = (WC_SUBLIST_TYPE(s->code) == WC_SUBLIST_END);
|
||||
if (WC_SUBLIST_FLAGS(s->code) & WC_SUBLIST_NOT)
|
||||
taddstr("! ");
|
||||
if (WC_SUBLIST_FLAGS(s->code) & WC_SUBLIST_NOT) {
|
||||
if (WC_SUBLIST_SKIP(s->code) == 0)
|
||||
stack = 1;
|
||||
taddstr((stack || (!(WC_SUBLIST_FLAGS(s->code) &
|
||||
WC_SUBLIST_SIMPLE) && wc_code(*state->pc) !=
|
||||
WC_PIPE)) ? "!" : "! ");
|
||||
}
|
||||
if (WC_SUBLIST_FLAGS(s->code) & WC_SUBLIST_COPROC)
|
||||
taddstr("coproc ");
|
||||
}
|
||||
|
@ -76,6 +76,39 @@
|
||||
0:Basic current shell list with error
|
||||
>false
|
||||
|
||||
fn() { : && ! ; : }
|
||||
functions -x3 fn
|
||||
fn
|
||||
0:End of sublist containing ! with no command
|
||||
>fn () {
|
||||
> : && !
|
||||
> :
|
||||
>}
|
||||
|
||||
if [[ m -eq y ]]; then
|
||||
: && !
|
||||
:
|
||||
fi
|
||||
0:! followed by no further commands
|
||||
|
||||
fn() { ! {!} && ! (!) || ! {!} }
|
||||
functions -x2 fn
|
||||
fn
|
||||
0:exclamation marks without following commands
|
||||
>fn () {
|
||||
> ! {
|
||||
> !
|
||||
> } && ! (
|
||||
> !
|
||||
> ) || ! {
|
||||
> !
|
||||
> }
|
||||
>}
|
||||
|
||||
! | true
|
||||
1:! followed by no command but by a pipe
|
||||
?(eval):1: parse error near `|'
|
||||
|
||||
#
|
||||
# Tests for `Precommand Modifiers'
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user