Bug 775234 - WebGL: fix 1-byte out-of-bounds access in compileShader - r=jgilbert

This commit is contained in:
Benoit Jacob 2012-07-25 12:13:45 -04:00
parent a740ec36a9
commit d06cfc9f52

View File

@ -5022,9 +5022,13 @@ WebGLContext::CompileShader(WebGLShader *shader)
// we always query uniform info, regardless of useShaderSourceTranslation, // we always query uniform info, regardless of useShaderSourceTranslation,
// as we need it to validate uniform setter calls, and it doesn't rely on // as we need it to validate uniform setter calls, and it doesn't rely on
// shader translation. // shader translation.
char mappedNameLength = strlen(mapped_name);
char mappedNameLastChar = mappedNameLength > 1
? mapped_name[mappedNameLength - 1]
: 0;
shader->mUniformInfos.AppendElement(WebGLUniformInfo( shader->mUniformInfos.AppendElement(WebGLUniformInfo(
size, size,
length > 1 && mapped_name[length - 1] == ']', mappedNameLastChar == ']',
type)); type));
} }