ref: a4158ae6fff14017f38c425df648c99681b5eb3a
parent: 9219eca1a1e8055b768730590ab7e8d444c94c55
author: Tor Andersson <tor.andersson@artifex.com>
date: Mon Jul 4 11:19:08 EDT 2016
Fix call stack overflow triggering off-by-one too late. Thanks to katlogic <kat@lua.cz> for spotting the error.
--- a/jsrun.c
+++ b/jsrun.c
@@ -1020,8 +1020,9 @@
static void jsR_pushtrace(js_State *J, const char *name, const char *file, int line)
{
- if (++J->tracetop == JS_ENVLIMIT)
+ if (J->tracetop + 1 == JS_ENVLIMIT)
js_error(J, "call stack overflow");
+ ++J->tracetop;
J->trace[J->tracetop].name = name;
J->trace[J->tracetop].file = file;
J->trace[J->tracetop].line = line;