mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 05:12:29 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user