<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>191220</bug_id>
          
          <creation_ts>2018-11-02 17:54:41 -0700</creation_ts>
          <short_desc>Assert JSValues can fit into a pointer when API casting</short_desc>
          <delta_ts>2018-11-05 10:56:28 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Keith Miller">keith_miller</reporter>
          <assigned_to name="Keith Miller">keith_miller</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1474698</commentid>
    <comment_count>0</comment_count>
    <who name="Keith Miller">keith_miller</who>
    <bug_when>2018-11-02 17:54:41 -0700</bug_when>
    <thetext>Assert JSValues can fit into a pointer when API casting</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1474699</commentid>
    <comment_count>1</comment_count>
      <attachid>353752</attachid>
    <who name="Keith Miller">keith_miller</who>
    <bug_when>2018-11-02 17:54:57 -0700</bug_when>
    <thetext>Created attachment 353752
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1474705</commentid>
    <comment_count>2</comment_count>
      <attachid>353752</attachid>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2018-11-02 18:27:46 -0700</bug_when>
    <thetext>Comment on attachment 353752
Patch

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1474709</commentid>
    <comment_count>3</comment_count>
      <attachid>353752</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-11-02 18:52:42 -0700</bug_when>
    <thetext>Comment on attachment 353752
Patch

Clearing flags on attachment: 353752

Committed r237764: &lt;https://trac.webkit.org/changeset/237764&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1474710</commentid>
    <comment_count>4</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-11-02 18:52:43 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1474711</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2018-11-02 18:53:34 -0700</bug_when>
    <thetext>&lt;rdar://problem/45779456&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1474813</commentid>
    <comment_count>6</comment_count>
      <attachid>353752</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2018-11-03 15:02:32 -0700</bug_when>
    <thetext>Comment on attachment 353752
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=353752&amp;action=review

&gt; Source/JavaScriptCore/API/APICast.h:83
&gt; +    static_assert(sizeof(OpaqueJSValue*) == sizeof(JSC::JSValue), &quot;JSValue needs to fit into a boxed pointer&quot;);
&gt;      JSC::JSValue result = JSC::JSValue::decode(reinterpret_cast&lt;JSC::EncodedJSValue&gt;(const_cast&lt;OpaqueJSValue*&gt;(v)));

I believe this is what bitwise_cast does.  You should just use that instead.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1474953</commentid>
    <comment_count>7</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2018-11-04 20:58:18 -0800</bug_when>
    <thetext>(In reply to Mark Lam from comment #6)
&gt; Comment on attachment 353752 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=353752&amp;action=review
&gt; 
&gt; &gt; Source/JavaScriptCore/API/APICast.h:83
&gt; &gt; +    static_assert(sizeof(OpaqueJSValue*) == sizeof(JSC::JSValue), &quot;JSValue needs to fit into a boxed pointer&quot;);
&gt; &gt;      JSC::JSValue result = JSC::JSValue::decode(reinterpret_cast&lt;JSC::EncodedJSValue&gt;(const_cast&lt;OpaqueJSValue*&gt;(v)));
&gt; 
&gt; I believe this is what bitwise_cast does.  You should just use that instead.

+1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1475168</commentid>
    <comment_count>8</comment_count>
    <who name="Keith Miller">keith_miller</who>
    <bug_when>2018-11-05 10:56:28 -0800</bug_when>
    <thetext>(In reply to Saam Barati from comment #7)
&gt; (In reply to Mark Lam from comment #6)
&gt; &gt; Comment on attachment 353752 [details]
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; https://bugs.webkit.org/attachment.cgi?id=353752&amp;action=review
&gt; &gt; 
&gt; &gt; &gt; Source/JavaScriptCore/API/APICast.h:83
&gt; &gt; &gt; +    static_assert(sizeof(OpaqueJSValue*) == sizeof(JSC::JSValue), &quot;JSValue needs to fit into a boxed pointer&quot;);
&gt; &gt; &gt;      JSC::JSValue result = JSC::JSValue::decode(reinterpret_cast&lt;JSC::EncodedJSValue&gt;(const_cast&lt;OpaqueJSValue*&gt;(v)));
&gt; &gt; 
&gt; &gt; I believe this is what bitwise_cast does.  You should just use that instead.
&gt; 
&gt; +1

Good point! I filed https://bugs.webkit.org/show_bug.cgi?id=191272.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>353752</attachid>
            <date>2018-11-02 17:54:57 -0700</date>
            <delta_ts>2018-11-02 18:52:42 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-191220-20181102175456.patch</filename>
            <type>text/plain</type>
            <size>2236</size>
            <attacher name="Keith Miller">keith_miller</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjM3NzQ1CmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCBl
ZGJkNjBhNTFmZDJhNGFiOWNiMTZmZjU0N2NiMGViYmZhYmNlMjdiLi4yNGZlNmJkOTY3Yjg1MWVl
N2Q5NmE4ODE1NTYxYTEwMGUwM2VmZjAxIDEwMDY0NAotLS0gYS9Tb3VyY2UvSmF2YVNjcmlwdENv
cmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKQEAgLTEs
MyArMSwxNSBAQAorMjAxOC0xMS0wMiAgS2VpdGggTWlsbGVyICA8a2VpdGhfbWlsbGVyQGFwcGxl
LmNvbT4KKworICAgICAgICBBc3NlcnQgSlNWYWx1ZXMgY2FuIGZpdCBpbnRvIGEgcG9pbnRlciB3
aGVuIEFQSSBjYXN0aW5nCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVn
LmNnaT9pZD0xOTEyMjAKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKwor
ICAgICAgICAqIEFQSS9BUElDYXN0Lmg6CisgICAgICAgICh0b0pTKToKKyAgICAgICAgKHRvSlNG
b3JHQyk6CisgICAgICAgICh0b1JlZik6CisKIDIwMTgtMTEtMDIgIEtlaXRoIE1pbGxlciAgPGtl
aXRoX21pbGxlckBhcHBsZS5jb20+CiAKICAgICAgICAgQVBJIHNob3VsZC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