Handle stack overflow in binary expressions in JS Parser (#7414)

* Fix stack overflow in large files

* Add test for stack overflow

* wip

* Disable cache in debug build

* Remove our extra `captureStackTrace` call

* Update RuntimeTranspilerCache.zig

* Update RuntimeTranspilerCache.zig

* Fix issues with integer environment variables

* Add missing ref

* Add missing null check

* Update bindings.cpp

* Update transpiler-cache.test.ts

* Add version check

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
Jarred Sumner
2023-12-02 12:46:25 +01:00
committed by GitHub
parent ffe447ba5a
commit b2bf3f0dcf
16 changed files with 815 additions and 491 deletions

View File

@@ -117,13 +117,16 @@ static bool evaluateCommonJSModuleOnce(JSC::VM& vm, Zig::GlobalObject* globalObj
moduleObject->hasEvaluated = true;
JSFunction* fn = jsCast<JSC::JSFunction*>(JSC::evaluate(globalObject, code->sourceCode(), jsUndefined(), exception));
// This will return 0 if there was a syntax error or an allocation failure
JSValue fnValue = JSC::evaluate(globalObject, code->sourceCode(), jsUndefined(), exception);
if (exception.get()) {
if (UNLIKELY(exception.get() || fnValue.isEmpty())) {
moduleObject->sourceCode.clear();
return false;
}
JSFunction* fn = jsCast<JSC::JSFunction*>(fnValue);
JSC::CallData callData = JSC::getCallData(fn);
MarkedArgumentBuffer args;
args.append(moduleObject->exportsObject()); // exports