aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-12-09 15:34:00 +0200
committerJukka Jylänki <jujjyl@gmail.com>2014-01-14 12:42:39 +0200
commit3ee72465de5bdebce7584f65586228ab5b32c01e (patch)
treed522fddb49090728f701f9544de9a37c5fe4c163 /src
parent726bbf32e89b8578df540af21194dac4d019eb67 (diff)
Fix (harmless) out-of-bounds access on vertex attribute indices in GL emulation init when GL_FFP_ONLY is set.
Diffstat (limited to 'src')
-rw-r--r--src/library_gl.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 64f13701..b96ba0f2 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -3643,7 +3643,8 @@ var LibraryGL = {
GLctx.bindAttribLocation(this.program, GLImmediate.VERTEX, 'a_position');
GLctx.bindAttribLocation(this.program, GLImmediate.COLOR, 'a_color');
GLctx.bindAttribLocation(this.program, GLImmediate.NORMAL, 'a_normal');
- for (var i = 0; i < GLImmediate.MAX_TEXTURES; i++) {
+ var maxVertexAttribs = GLctx.getParameter(GLctx.MAX_VERTEX_ATTRIBS);
+ for (var i = 0; i < GLImmediate.MAX_TEXTURES && GLImmediate.TEXTURE0 + i < maxVertexAttribs; i++) {
GLctx.bindAttribLocation(this.program, GLImmediate.TEXTURE0 + i, 'a_texCoord'+i);
GLctx.bindAttribLocation(this.program, GLImmediate.TEXTURE0 + i, aTexCoordPrefix+i);
}