Bug 705663 - Fix braindead WebGLTexture::HasImageInfoAt - r=jrmuizel
authorBenoit Jacob <bjacob@mozilla.com>
Mon, 28 Nov 2011 14:30:28 -0500
changeset 82506 bc48009a6bbb3ab7d6f0b87c0c11aaed2c4691d6
parent 82505 accfde65e3c7ceb5d3524e48006caa0e5b1c6cdf
child 82507 e3c8a14cd60b9d9f2b19f94ddc54f740a00c7d75
child 84607 9dc80d92e1f31f69235b2a461578659113616a41
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs705663
milestone11.0a1
first release with
nightly linux32
bc48009a6bbb / 11.0a1 / 20111129031019 / files
nightly linux64
bc48009a6bbb / 11.0a1 / 20111129031019 / files
nightly mac
bc48009a6bbb / 11.0a1 / 20111129031019 / files
nightly win32
bc48009a6bbb / 11.0a1 / 20111129031019 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 705663 - Fix braindead WebGLTexture::HasImageInfoAt - r=jrmuizel
content/canvas/src/WebGLContext.h
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -1082,19 +1082,20 @@ public:
         return mImageInfos.ElementAt(level * mFacesCount + face);
     }
 
     const ImageInfo& ImageInfoAt(size_t level, size_t face) const {
         return const_cast<WebGLTexture*>(this)->ImageInfoAt(level, face);
     }
 
     bool HasImageInfoAt(size_t level, size_t face) const {
-        return level <= mMaxLevelWithCustomImages &&
-               face < mFacesCount &&
-               ImageInfoAt(level, 0).mIsDefined;
+        CheckedUint32 checked_index = CheckedUint32(level) * mFacesCount + face;
+        return checked_index.valid() &&
+               checked_index.value() < mImageInfos.Length() &&
+               ImageInfoAt(level, face).mIsDefined;
     }
 
     static size_t FaceForTarget(WebGLenum target) {
         return target == LOCAL_GL_TEXTURE_2D ? 0 : target - LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X;
     }
 
     PRInt64 MemoryUsage() const {
         PRInt64 result = 0;