[Webkit-unassigned] [Bug 257737] New: Speculative crash in WebCoreTypedArrayController::registerWrapper when JSGlobalObject* is not a JSDOMGlobalObject

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 5 18:37:38 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=257737

            Bug ID: 257737
           Summary: Speculative crash in
                    WebCoreTypedArrayController::registerWrapper when
                    JSGlobalObject* is not a JSDOMGlobalObject
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jarred at jarredsumner.com

The following line segfaults if it becomes possible for JSC::JSGlobalObject* to not be a JSDOMGlobalObject* in WebCore. For example, if ShadowRealm returns a non-JSDOMGlobalObject.

```
void WebCoreTypedArrayController::registerWrapper(JSC::JSGlobalObject* globalObject, JSC::ArrayBuffer* native, JSC::JSArrayBuffer* wrapper)
{
    cacheWrapper(JSC::jsCast<JSDOMGlobalObject*>(globalObject)->world(), native, wrapper);
}
```

This code was copied into Bun and in Bun's case, the Node.js "vm" module can be used to return an `ArrayBuffer` constructed in a different realm which is not a JSDOMGlobalObject*, so `require('vm').runInNewContext("new ArrayBuffer(42)")` segfaulted

https://github.com/oven-sh/bun/blob/17bca62df10008b2d252d5b63bd9b028e9fcd1c0/src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp#L54-L57

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230606/26913e3d/attachment.htm>


More information about the webkit-unassigned mailing list