From a60b2656c264aa9306623ab8a07839b436b3ba48 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Tue, 5 Mar 2013 13:36:06 -0800 Subject: [PATCH] Bug 847716 - bindAttribLocation for /_?webgl_.*/ should generate INVALID_OPERATION - r=bjacob --- content/canvas/src/WebGLContextValidate.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/content/canvas/src/WebGLContextValidate.cpp b/content/canvas/src/WebGLContextValidate.cpp index a282118f324c..f8efb4a7c69f 100644 --- a/content/canvas/src/WebGLContextValidate.cpp +++ b/content/canvas/src/WebGLContextValidate.cpp @@ -339,6 +339,16 @@ bool WebGLContext::ValidateGLSLVariableName(const nsAString& name, const char *i return false; } + nsString prefix1 = NS_LITERAL_STRING("webgl_"); + nsString prefix2 = NS_LITERAL_STRING("_webgl_"); + + if (Substring(name, 0, prefix1.Length()).Equals(prefix1) || + Substring(name, 0, prefix2.Length()).Equals(prefix2)) + { + ErrorInvalidOperation("%s: string contains a reserved GLSL prefix", info); + return false; + } + return true; }