diff options
author | 2023-06-05 17:17:35 -0700 | |
---|---|---|
committer | 2023-06-05 17:17:48 -0700 | |
commit | 0c11762c310c2655fe5c3ecc60671c93934abdc3 (patch) | |
tree | 6fc2b4bbf658ee5fd2d5c62933f6f1ff411d026a /src | |
parent | fe7d5357d8b025c671944705047338c1aa26be4a (diff) | |
download | bun-0c11762c310c2655fe5c3ecc60671c93934abdc3.tar.gz bun-0c11762c310c2655fe5c3ecc60671c93934abdc3.tar.zst bun-0c11762c310c2655fe5c3ecc60671c93934abdc3.zip |
[node:vm] Fix crash when `new ArrayBuffer()` is returned
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp b/src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp index 4c9660e26..ca8c79aef 100644 --- a/src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp +++ b/src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp @@ -51,6 +51,10 @@ JSC::JSArrayBuffer* WebCoreTypedArrayController::toJS(JSC::JSGlobalObject* lexic void WebCoreTypedArrayController::registerWrapper(JSC::JSGlobalObject* globalObject, JSC::ArrayBuffer* native, JSC::JSArrayBuffer* wrapper) { + // require("vm") can be used to create an ArrayBuffer + if (UNLIKELY(!globalObject->inherits<JSDOMGlobalObject>())) + return; + cacheWrapper(JSC::jsCast<JSDOMGlobalObject*>(globalObject)->world(), native, wrapper); } |