Skip to content

Commit 2bf7c59

Browse files
committed
Make sure execution stops for native functions if there's an error when parsing arguments
1 parent f84d113 commit 2bf7c59

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Fix 'lock overflow' when calling methods with 'this' bound (fix #870, fix #885)
55
Fix jsvStringIteratorGetCharOrMinusOne for zero-length strings
66
Allow tab-completion straight after '.'
7+
Make sure execution stops for native functions if there's an error when parsing arguments
78

89
1v86 : Compile Telnet server into linux by default, Add '--telnet' command-line option to enable it
910
Fix lock 'leak' in Telnet when Telnet is turned off

src/jsparse.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ NO_INLINE JsVar *jspeFunctionCall(JsVar *function, JsVar *functionName, JsVar *t
533533
// Now, if we're parsing add the rest of the arguments
534534
int allocatedArgCount = boundArgs;
535535
if (isParsing) {
536-
while (!JSP_SHOULDNT_PARSE && lex->tk!=')' && lex->tk!=LEX_EOF) {
536+
while (!JSP_HAS_ERROR && lex->tk!=')' && lex->tk!=LEX_EOF) {
537537
if ((unsigned)argCount>=argPtrSize) {
538538
// allocate more space on stack
539539
unsigned int newArgPtrSize = argPtrSize?argPtrSize*4:16;
@@ -572,10 +572,9 @@ NO_INLINE JsVar *jspeFunctionCall(JsVar *function, JsVar *functionName, JsVar *t
572572

573573

574574

575-
if (nativePtr) {
575+
if (nativePtr && !JSP_HAS_ERROR) {
576576
returnVar = jsnCallFunction(nativePtr, function->varData.native.argTypes, thisVar, argPtr, argCount);
577577
} else {
578-
assert(0); // in case something went horribly wrong
579578
returnVar = 0;
580579
}
581580

0 commit comments

Comments
 (0)