<?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>179511</bug_id>
          
          <creation_ts>2017-11-09 16:34:57 -0800</creation_ts>
          <short_desc>[WPE] GLContextEGLWPE.cpp:44:96: error: invalid cast from type ‘GLNativeWindowType {aka long long unsigned int}’ to type ‘EGLNativeWindowType {aka unsigned int}</short_desc>
          <delta_ts>2017-11-20 07:58:02 -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>WPE WebKit</component>
          <version>Other</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>178894</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Carlos Alberto Lopez Perez">clopez</assigned_to>
          <cc>aperez</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>buildbot</cc>
    
    <cc>cgarcia</cc>
    
    <cc>clopez</cc>
    
    <cc>commit-queue</cc>
    
    <cc>magomez</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>ticaiolima</cc>
    
    <cc>zan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1370107</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-11-09 16:34:57 -0800</bug_when>
    <thetext>When building for 32-bit ARM:

./platform/graphics/egl/GLContextEGLWPE.cpp: In static member function ‘static void* WebCore::GLContextEGL::createWindowSurfaceWPE(EGLDisplay, EGLConfig, GLNativeWindowType)’:
./platform/graphics/egl/GLContextEGLWPE.cpp:44:96: error: invalid cast from type ‘GLNativeWindowType {aka long long unsigned int}’ to type ‘EGLNativeWindowType {aka unsigned int}’
     return eglCreateWindowSurface(display, config, reinterpret_cast&lt;EGLNativeWindowType&gt;(window), nullptr);

So, that cast is clearly illegal. GLNativeWindowType is larger than EGLNativeWindowType, so it&apos;s not safe to cast in that direction.

I notice that GLNativeWindowType is defined oddly in GLContext.h:

#if USE(EGL) &amp;&amp; !PLATFORM(GTK) &amp;&amp; !PLATFORM(WPE)
#include &quot;eglplatform.h&quot;
typedef EGLNativeWindowType GLNativeWindowType;
#else
typedef uint64_t GLNativeWindowType;
#endif

I&apos;m genuinely uncertain where the declaration of EGLNativeWindowType is coming from, but I see this in ANGLE&apos;s eglplatform.h:

#elif defined(USE_OZONE) || defined(USE_WPE)

typedef intptr_t EGLNativeDisplayType;
typedef intptr_t EGLNativeWindowType;
typedef intptr_t EGLNativePixmapType;

And of course, intptr_t is a 32-bit type. I have no clue how this is supposed to work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1370333</commentid>
    <comment_count>1</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-11-10 08:26:29 -0800</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #0)
&gt; I&apos;m genuinely uncertain where the declaration of EGLNativeWindowType is
&gt; coming from, but I see this in ANGLE&apos;s eglplatform.h:
&gt; 

EGLNativeWindowType is declared in /usr/include/EGL/eglplatform.h and has different definitions depending on the EGL platform you have defined (GBM, WaylandEGL, X11, etc)


I think ANGLE headers should not be used for building this file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1370387</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-11-10 09:50:32 -0800</bug_when>
    <thetext>I don&apos;t know if ANGLE headers are actually used or not. I don&apos;t know where the definition of EGLNativeWindowType is coming from. But I&apos;d be surprised that we have it defined to be intptr_t there if we&apos;re not using it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1372502</commentid>
    <comment_count>3</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-11-15 17:08:08 -0800</bug_when>
    <thetext>I have been bitten by this, so I have checked it.

I think this started to happen with r217208 &lt;https://trac.webkit.org/r217208&gt;

Patch incoming ..</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1372508</commentid>
    <comment_count>4</comment_count>
      <attachid>327039</attachid>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-11-15 17:36:25 -0800</bug_when>
    <thetext>Created attachment 327039
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1372509</commentid>
    <comment_count>5</comment_count>
    <who name="Build Bot">buildbot</who>
    <bug_when>2017-11-15 17:38:28 -0800</bug_when>
    <thetext>Attachment 327039 did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:3:  Please consider whether the use of security-sensitive phrasing could help someone exploit WebKit: invalid cast  [changelog/unwantedsecurityterms] [3]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1372649</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-11-16 09:30:15 -0800</bug_when>
    <thetext>Thanks. I&apos;m not qualified to review this; please ask Miguel and Zan.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1372905</commentid>
    <comment_count>7</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-11-16 17:09:26 -0800</bug_when>
    <thetext>(In reply to Carlos Alberto Lopez Perez from comment #3)
&gt; 
&gt; I think this started to happen with r217208 &lt;https://trac.webkit.org/r217208&gt;
&gt; 

When I wrote that I didn&apos;t noticed the age of the commit (6 months ago).. 
And IIRC I did ARMv7 builds of WPE trunk 1-2 months ago.

So I guess something else than r217208 caused this

In any case I still think the attached patch is ok, so any review of it is appreciated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1373780</commentid>
    <comment_count>8</comment_count>
      <attachid>327039</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-11-20 07:58:00 -0800</bug_when>
    <thetext>Comment on attachment 327039
Patch

Clearing flags on attachment: 327039

Committed r225051: &lt;https://trac.webkit.org/changeset/225051&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1373781</commentid>
    <comment_count>9</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-11-20 07:58:02 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>327039</attachid>
            <date>2017-11-15 17:36:25 -0800</date>
            <delta_ts>2017-11-20 07:58:00 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-179511-20171116023624.patch</filename>
            <type>text/plain</type>
            <size>2228</size>
            <attacher name="Carlos Alberto Lopez Perez">clopez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjI0ODg2CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggZWFkOTM1YTc4ZGU4ZDQx
NjUxOWJmYWU4ZWFmMDI0NDQ1MTljN2Y2My4uNjAxYzkwNzEwNmIxMzJhMjc5ZGVlMmRkOWM0MzNl
ZTgzZWViODVlYSAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDIyIEBACisyMDE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