1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-08-23 19:01:05 +02:00

40173: Off-by-one error checking for {varid}.

This caused a single unprintable character in braces before a
redirection to be treated as an indentifier.
This commit is contained in:
Peter Stephenson 2017-05-08 18:00:55 +01:00
parent 641a764b82
commit af1c82d646
3 changed files with 13 additions and 1 deletions

View file

@ -1,5 +1,8 @@
2017-05-08 Peter Stephenson <p.stephenson@samsung.com>
* 41073: Src/parse.c, Test/A04redirect.ztst: off-by-one error
checking for {varid} syntax.
* users/22688: Src/parse.c, Test/A04redirect.ztst: Allow mixing
of redirections and arguments after anonymous functions.

View file

@ -1836,7 +1836,7 @@ par_simple(int *cmplx, int nr)
if (*ptr == Outbrace && ptr > tokstr + 1)
{
if (itype_end(tokstr+1, IIDENT, 0) >= ptr - 1)
if (itype_end(tokstr+1, IIDENT, 0) >= ptr)
{
char *toksave = tokstr;
char *idstring = dupstrpfx(tokstr+1, eptr-tokstr-1);

View file

@ -165,6 +165,15 @@
?About to close a second time
*?\(eval\):*: failed to close file descriptor *
eval $'fn-varid() { print {\x18}<<0 }'
{ which -x2 fn-varid; fn-varid } | tr $'\x18' '?'
0:Regression test for off-by-one in varid check
>fn-varid () {
> print {?} <<0
>0
>}
>{?}
print foo >&-
0:'>&-' redirection