Skip to content

Commit

Permalink
Fix potential for crash after ReferenceError during function declarat…
Browse files Browse the repository at this point in the history
…ion (fix #2457)

This time do it without breaking everything
  • Loading branch information
gfwilliams committed Feb 1, 2024
1 parent 856a5f6 commit 3814058
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Fix issue with g.wrapString when running on flash-based strings
Fix lock leak when using flat/flash/native strings as object indices
Fix g.wrapString lockup if wrap width is less than the character width
Fix potential for crash after ReferenceError during function declaration (fix #2457)

2v20 : Ensure String.charCodeAt returns NaN for out of bounds chars
Bangle.js2: When rendering overlays, *do not* use the current FG/BG color for 1 bit overlays
Expand Down
4 changes: 2 additions & 2 deletions src/jsparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,8 @@ NO_INLINE JsVar *jspeFunctionCall(JsVar *function, JsVar *functionName, JsVar *t

return returnVar;
} else if (isParsing) { // ---------------------------------- function, but not executing - just parse args and be done
jspeParseFunctionCallBrackets();
if (jspCheckStackPosition()) // check for stack overflow
jspeParseFunctionCallBrackets();
/* Do not return function, as it will be unlocked! */
return 0;
} else return 0;
Expand Down Expand Up @@ -1319,7 +1320,6 @@ NO_INLINE JsVar *jspeFactorFunctionCall() {
while ((lex->tk=='(' || (isConstructor && JSP_SHOULD_EXECUTE)) && !jspIsInterrupted()) {
JsVar *funcName = a;
JsVar *func = jsvSkipName(funcName);

/* The constructor function doesn't change parsing, so if we're
* not executing, just short-cut it. */
if (isConstructor && JSP_SHOULD_EXECUTE) {
Expand Down

0 comments on commit 3814058

Please sign in to comment.