Bug 680722: added invalid character checks to WebGL functions r=bjacob
This commit is contained in:
@@ -328,14 +328,31 @@ PRBool WebGLContext::ValidateDrawModeEnum(WebGLenum mode, const char *info)
|
||||
}
|
||||
}
|
||||
|
||||
bool WebGLContext::ValidateGLSLIdentifier(const nsAString& name, const char *info)
|
||||
bool WebGLContext::ValidateGLSLVariableName(const nsAString& name, const char *info)
|
||||
{
|
||||
const PRUint32 maxSize = 4095;
|
||||
const PRUint32 maxSize = 255;
|
||||
if (name.Length() > maxSize) {
|
||||
ErrorInvalidValue("%s: identifier is %d characters long, exceeds the maximum allowed length of %d characters",
|
||||
info, name.Length(), maxSize);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ValidateGLSLString(name, info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WebGLContext::ValidateGLSLString(const nsAString& string, const char *info)
|
||||
{
|
||||
for (PRUint32 i = 0; i < string.Length(); ++i) {
|
||||
if (!ValidateGLSLCharacter(string.CharAt(i))) {
|
||||
ErrorInvalidValue("%s: string contains the illegal character '%d'", info, string.CharAt(i));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user