diff --git a/content/canvas/src/WebGLContext.h b/content/canvas/src/WebGLContext.h index 75439ce8d61..2372785a142 100644 --- a/content/canvas/src/WebGLContext.h +++ b/content/canvas/src/WebGLContext.h @@ -1087,9 +1087,10 @@ public: } 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) {