diff options
author | Mikael Magnusson <mikachu@gmail.com> | 2013-03-13 19:54:20 +0000 |
---|---|---|
committer | Mikael Magnusson <mikachu@gmail.com> | 2013-03-13 19:54:20 +0000 |
commit | 1d3d92a0c9a5e10228b42ce3a62e8de354748051 (patch) | |
tree | 63ef59ac43de283fc0ac5e825dab7abfebeb9fc3 | |
parent | dcbeba98898463acc213b7b55fc09a74d6a2e60b (diff) | |
download | zsh-1d3d92a0c9a5e10228b42ce3a62e8de354748051.tar.gz zsh-1d3d92a0c9a5e10228b42ce3a62e8de354748051.tar.xz zsh-1d3d92a0c9a5e10228b42ce3a62e8de354748051.zip |
31140: avoid crash when hitting recursion limit
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Src/math.c | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index f4f3a1990..21eaa18b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,11 @@ * unposted: Doc/Zsh/contrib.yo: Also adjust a mention of psvar in the vcs info documentation. + * 31140: Src/math.c: when the math recursion limit is hit, make + sure to not leave *ep pointing nowhere, which caused a crash + sometimes. Also print the token that we refused to evaluate + because of the limit. + 2013-03-13 Peter Stephenson <p.w.stephenson@ntlworld.com> * unposted, c.f. thread from 31144: Doc/Zsh/params.yo: all psvar @@ -593,5 +598,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5819 $ +* $Revision: 1.5820 $ ***************************************************** diff --git a/Src/math.c b/Src/math.c index f8a4eefeb..a2462a32e 100644 --- a/Src/math.c +++ b/Src/math.c @@ -362,8 +362,9 @@ mathevall(char *s, enum prec_type prec_tp, char **ep) if (mlevel >= MAX_MLEVEL) { xyyval.type = MN_INTEGER; xyyval.u.l = 0; + *ep = s; - zerr("math recursion limit exceeded"); + zerr("math recursion limit exceeded: %s", *ep); return xyyval; } |