<?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>143549</bug_id>
          
          <creation_ts>2015-04-08 19:57:32 -0700</creation_ts>
          <short_desc>[WebGL]WebKit will crash when GraphicsContext3D::createForCurrentGLContext() return null</short_desc>
          <delta_ts>2024-01-17 01:09:03 -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>WebGL</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="await_me">jy_lizl</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>kkinnunen</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1083819</commentid>
    <comment_count>0</comment_count>
    <who name="await_me">jy_lizl</who>
    <bug_when>2015-04-08 19:57:32 -0700</bug_when>
    <thetext>if GraphicsContext3D::createForCurrentGLContext() return 0 in TextureMapperGL&apos;s constructor,WebKit will crash
serval code and call stack is like follow:
WebCore::TextureMapperGLData::SharedGLData::currentSharedGLData(context) {GLContextDataMap::iterator it = glContextDataMap().find(context-&gt;platformGraphicsContext3D());}
WebCore::TextureMapperGLData::TextureMapperGLData(GraphicsContext3D* context) :context(context),sharedData(TextureMapperGLData::SharedGLData::currentSharedGLData(this-&gt;context)){}
WebCore::TextureMapperGL::TextureMapperGL() { m_context3D = GraphicsContext3D::createForCurrentGLContext();m_data = new TextureMapperGLData(m_context3D.get());}

when GraphicsContext3D::createForCurrentGLContext() return null, the parameters(m_context3D,context) will be null.
but currentSharedGLData had used context without null-check.
this will make webkit crash.

createForCurrentGLContext() method is as follow:
PassRefPtr&lt;GraphicsContext3D&gt; GraphicsContext3D::createForCurrentGLContext()
{
    RefPtr&lt;GraphicsContext3D&gt; context = adoptRef(new GraphicsContext3D(Attributes(), 0, GraphicsContext3D::RenderToCurrentGLContext));
    return context-&gt;m_private ? context.release() : 0;
}

when port has something wrong, context-&gt;m_private will be null.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>