Bug 191220

Summary: Assert JSValues can fit into a pointer when API casting
Product: WebKit Reporter: Keith Miller <keith_miller>
Component: New BugsAssignee: Keith Miller <keith_miller>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ews-watchlist, mark.lam, msaboff, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Keith Miller
Reported 2018-11-02 17:54:41 PDT
Assert JSValues can fit into a pointer when API casting
Attachments
Patch (2.18 KB, patch)
2018-11-02 17:54 PDT, Keith Miller
no flags
Keith Miller
Comment 1 2018-11-02 17:54:57 PDT
Michael Saboff
Comment 2 2018-11-02 18:27:46 PDT
Comment on attachment 353752 [details] Patch r=me
WebKit Commit Bot
Comment 3 2018-11-02 18:52:42 PDT
Comment on attachment 353752 [details] Patch Clearing flags on attachment: 353752 Committed r237764: <https://trac.webkit.org/changeset/237764>
WebKit Commit Bot
Comment 4 2018-11-02 18:52:43 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 5 2018-11-02 18:53:34 PDT
Mark Lam
Comment 6 2018-11-03 15:02:32 PDT
Comment on attachment 353752 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=353752&action=review > Source/JavaScriptCore/API/APICast.h:83 > + static_assert(sizeof(OpaqueJSValue*) == sizeof(JSC::JSValue), "JSValue needs to fit into a boxed pointer"); > JSC::JSValue result = JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v))); I believe this is what bitwise_cast does. You should just use that instead.
Saam Barati
Comment 7 2018-11-04 20:58:18 PST
(In reply to Mark Lam from comment #6) > Comment on attachment 353752 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=353752&action=review > > > Source/JavaScriptCore/API/APICast.h:83 > > + static_assert(sizeof(OpaqueJSValue*) == sizeof(JSC::JSValue), "JSValue needs to fit into a boxed pointer"); > > JSC::JSValue result = JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v))); > > I believe this is what bitwise_cast does. You should just use that instead. +1
Keith Miller
Comment 8 2018-11-05 10:56:28 PST
(In reply to Saam Barati from comment #7) > (In reply to Mark Lam from comment #6) > > Comment on attachment 353752 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=353752&action=review > > > > > Source/JavaScriptCore/API/APICast.h:83 > > > + static_assert(sizeof(OpaqueJSValue*) == sizeof(JSC::JSValue), "JSValue needs to fit into a boxed pointer"); > > > JSC::JSValue result = JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v))); > > > > I believe this is what bitwise_cast does. You should just use that instead. > > +1 Good point! I filed https://bugs.webkit.org/show_bug.cgi?id=191272.
Note You need to log in before you can comment on or make changes to this bug.