Bug 1443149 - Ensure WebGLFBAttachPoint::HasImage() before dereferencing Format(). r=jrmuizel
authorJamie Nicol <jnicol@mozilla.com>
Wed, 14 Mar 2018 16:42:37 +0000
changeset 467452 ebb9f83337a22ae8e77c3e7129f65178f1bedec5
parent 467451 d8986aead3e05be3a7f15252c098e7da173c42aa
child 467453 208bfd37417ee5ad04d5819029697db901f7a468
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1443149
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1443149 - Ensure WebGLFBAttachPoint::HasImage() before dereferencing Format(). r=jrmuizel 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;