Bug 1357090 - Check that a texture's level_base is not too high. r=daoshengmu, a=gchang
authorJeff Gilbert <jgilbert@mozilla.com>
Mon, 22 May 2017 09:53:23 -0400
changeset 394061 dc0239918676fad03fa337e266a7405be721b25a
parent 394060 2be2b90e9c077bf4ff3c523ca8374c5a44d051f2
child 394062 c58deb31c649510a264a7593359da8b910b01141
push id7350
push userryanvm@gmail.com
push dateWed, 24 May 2017 13:47:11 +0000
treeherdermozilla-beta@c58deb31c649 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaoshengmu, gchang
bugs1357090
milestone54.0
Bug 1357090 - Check that a texture's level_base is not too high. r=daoshengmu, a=gchang MozReview-Commit-ID: 1EKDTrcTacw
dom/canvas/WebGLTexture.cpp
--- a/dom/canvas/WebGLTexture.cpp
+++ b/dom/canvas/WebGLTexture.cpp
@@ -309,16 +309,22 @@ WebGLTexture::IsCubeComplete() const
 }
 
 bool
 WebGLTexture::IsComplete(const char* funcName, uint32_t texUnit,
                          const char** const out_reason, bool* const out_initFailed)
 {
     *out_initFailed = false;
 
+    const auto maxLevel = kMaxLevelCount - 1;
+    if (mBaseMipmapLevel > maxLevel) {
+        *out_reason = "`level_base` too high.";
+        return false;
+    }
+
     if (!EnsureLevelInitialized(funcName, mBaseMipmapLevel)) {
         *out_initFailed = true;
         return false;
     }
 
     // Texture completeness is established at GLES 3.0.4, p160-161.
     // "[A] texture is complete unless any of the following conditions hold true:"