Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Don't crash when math recursion limit is exceeded
- X-seq: zsh-workers 31134
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: Don't crash when math recursion limit is exceeded
- Date: Sun, 10 Mar 2013 13:06:37 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer; bh=RCpllQKc01RHKGK6PNWah/Ys4YOEprTMonzal0yHeMY=; b=m7WrTj/smA5GGhveOqydSyOw1u2VVFWVpM7NQ3z2QOmUVrkIJx7w8cT0YWNlMgmkI6 ZPym/9dPCojtWQZPNjcnTN8KuL+gOkNjNPAJyGiRJV4tCKMXD3oZw8aQb80X3qmXogyi l0DUUF7J7T5VEXeMf6RrS3Dd7TqYUB+fUW09IBI8fsacUdnJayUTDQwUTm0NZxVX4DfJ iO6gGp6wTA6GdTMEZaq1L+4wwQZ3FpF0Gvfh9hV2IqpK8dxIR74TZrlYFn0IcDs/Rnaw 9uFRpA2PEF2OekM8b4l//y/txjKKWCPmqRCIsIhg45AeNpuC0Et7VTRcaFB3d4fTkdrO ypDA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This used to never trigger for me when compiling in debug mode, but I
finally had better luck today and tracked it down.
*ep seems to already be NULL, but I couldn't quite figure out where it
was set to NULL so I figured it can't hurt to make it explicitly NULL
at that point. I suppose setting *ep = ""; would also work (without the
second hunk)?
---
Src/math.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Src/math.c b/Src/math.c
index f8a4eef..43cede9 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -362,6 +362,7 @@ mathevall(char *s, enum prec_type prec_tp, char **ep)
if (mlevel >= MAX_MLEVEL) {
xyyval.type = MN_INTEGER;
xyyval.u.l = 0;
+ *ep = NULL;
zerr("math recursion limit exceeded");
@@ -1352,7 +1353,7 @@ matheval(char *s)
}
x = mathevall(s, MPREC_TOP, &junk);
mtok = xmtok;
- if (*junk)
+ if (junk && *junk)
zerr("bad math expression: illegal character: %c", *junk);
return x;
}
--
1.7.10.GIT
Messages sorted by:
Reverse Date,
Date,
Thread,
Author