about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Src/math.c3
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;
     }