| Index: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
|
| diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
|
| index d92a66c0d01553210f24831c756c331b6a5b6c95..9f192c103242e66b772cdba52d88ae38082faf43 100644
|
| --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
|
| +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
|
| @@ -2316,9 +2316,23 @@
|
| return webContext()->getUniformBlockIndex(objectOrZero(program), uniformBlockName.utf8().data());
|
| }
|
|
|
| +bool WebGL2RenderingContextBase::validateUniformBlockIndex(const char* functionName, WebGLProgram* program, GLuint blockIndex)
|
| +{
|
| + GLint activeUniformBlocks = 0;
|
| + webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCKS, &activeUniformBlocks);
|
| + if (blockIndex >= static_cast<GLuint>(activeUniformBlocks)) {
|
| + synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid uniform block index");
|
| + return false;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| ScriptValue WebGL2RenderingContextBase::getActiveUniformBlockParameter(ScriptState* scriptState, WebGLProgram* program, GLuint uniformBlockIndex, GLenum pname)
|
| {
|
| if (isContextLost() || !validateWebGLObject("getActiveUniformBlockParameter", program))
|
| + return ScriptValue::createNull(scriptState);
|
| +
|
| + if (!validateUniformBlockIndex("getActiveUniformBlockParameter", program, uniformBlockIndex))
|
| return ScriptValue::createNull(scriptState);
|
|
|
| switch (pname) {
|
| @@ -2357,6 +2371,9 @@
|
| if (isContextLost() || !validateWebGLObject("getActiveUniformBlockName", program))
|
| return String();
|
|
|
| + if (!validateUniformBlockIndex("getActiveUniformBlockName", program, uniformBlockIndex))
|
| + return String();
|
| +
|
| GLint maxNameLength = -1;
|
| webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &maxNameLength);
|
| if (maxNameLength <= 0) {
|
| @@ -2373,6 +2390,9 @@
|
| void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
|
| {
|
| if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program))
|
| + return;
|
| +
|
| + if (!validateUniformBlockIndex("uniformBlockBinding", program, uniformBlockIndex))
|
| return;
|
|
|
| webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex, uniformBlockBinding);
|
|
|