Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Zsh parser infinite loop in chuck from utils.c on malformed input

On May 8,  9:00am, Eduardo Bustamante wrote:
} I'm not sure if this is working as expected, but the following input
} causes Zsh running with noexec to loop forever.

The basis of this is ${(%%%%EuzktiOn)aY- which is the expansion of $aY
with a whole lot of parameter flags.  Since aY is unset, the last "-"
means that most of the flags are instead applied to all the rest of
the crap that follows.

This probably should have been a parse error because the { } are not
balanced, but I'm guessing the parser returns a complete expression
when it hits EOF.  Anyway, parameter expansion is one of the few things
that happens in noexec, and those %%%% in the flags list mean to treat
all that garbage as a prompt ... so I suspect it's not actually in an
*infinite* loop, just one that is going to repeat 3333333333333333333

Unless we want to put some arbitrary limits on numbers used in prompt
expansion, I don't think there's anything to be done here.  Even if
the unbalanced { } were detected, adding another } at the end of the
file would probably bring back the looping.

Messages sorted by: Reverse Date, Date, Thread, Author