Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1223)

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLTexture.cpp

Issue 1468883002: Fix the crash of compressedTexImage3D for the WebGL2 conformance test page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add the check validation of level. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webgl/WebGLTexture.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLTexture.cpp b/third_party/WebKit/Source/modules/webgl/WebGLTexture.cpp
index 80d5bd122550a8930eb8e6535f6b55be582539e1..0da69183b33a70738d0afb3a4785a9934dd4e3ba 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLTexture.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLTexture.cpp
@@ -286,6 +286,18 @@ bool WebGLTexture::isValid(GLenum target, GLint level) const
return info->valid;
}
+bool WebGLTexture::isValidLevel(GLenum target, GLint level) const
+{
+ if (!object() || !m_target)
+ return false;
+ int targetIndex = mapTargetToIndex(target);
+ if (targetIndex < 0 || targetIndex >= static_cast<int>(m_info.size()))
+ return false;
+ if (level < 0 || level >= static_cast<GLint>(m_info[targetIndex].size()))
+ return false;
+ return true;
+}
+
bool WebGLTexture::isNPOT(GLsizei width, GLsizei height)
{
ASSERT(width >= 0 && height >= 0);

Powered by Google App Engine
This is Rietveld 408576698