Bug 1443149 - Ensure WebGLFBAttachPoint::HasImage() before dereferencing Format(). r=jrmuizel a=jcristau
authorJamie Nicol <jnicol@mozilla.com>
Wed, 14 Mar 2018 16:42:37 +0000
changeset 460912 6dccd26e00afeaa2b62671e87fd8b634ba67ed81
parent 460911 dad20eed22b948cfc168a6d4dcfe49e446a05c65
child 460913 8b59be7c1ce63c7d70b53a8fd76f019c9a63ea6e
push id9093
push userarchaeopteryx@coole-files.de
push dateThu, 19 Apr 2018 16:07:07 +0000
treeherdermozilla-beta@d84374efea51 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, jcristau
bugs1443149
milestone60.0
Bug 1443149 - Ensure WebGLFBAttachPoint::HasImage() before dereferencing Format(). r=jrmuizel a=jcristau Previously we were checking IsDefined() rather than HasImage(), but were hitting crashes. This was because Format() can return null if the attach point is defined but the attached texture level or renderbuffer aren't themselves defined. HasImage() checks for this case. MozReview-Commit-ID: 8KY3zPXXAFv
dom/canvas/WebGLContextFramebufferOperations.cpp
--- a/dom/canvas/WebGLContextFramebufferOperations.cpp
+++ b/dom/canvas/WebGLContextFramebufferOperations.cpp
@@ -28,17 +28,17 @@ WebGLContext::Clear(GLbitfield mask)
         GenerateWarning("Calling gl.clear(0) has no effect.");
     } else if (mRasterizerDiscardEnabled) {
         GenerateWarning("Calling gl.clear() with RASTERIZER_DISCARD enabled has no effects.");
     }
 
     if (mask & LOCAL_GL_COLOR_BUFFER_BIT && mBoundDrawFramebuffer) {
         if (mask & LOCAL_GL_COLOR_BUFFER_BIT) {
             for (const auto& cur : mBoundDrawFramebuffer->ColorDrawBuffers()) {
-                if (!cur->IsDefined())
+                if (!cur->HasImage())
                     continue;
 
                 switch (cur->Format()->format->componentType) {
                 case webgl::ComponentType::Float:
                 case webgl::ComponentType::NormInt:
                 case webgl::ComponentType::NormUInt:
                     break;