From 1549e9ac38aee40f8eb044e4ac1040ba4fa92654 Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Thu, 6 Jan 2011 14:07:13 -0800 Subject: [PATCH] b=623394; [webgl] don't allow non-ascii characters in GLSL source; r=bjacob --- content/canvas/src/WebGLContextGL.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/canvas/src/WebGLContextGL.cpp b/content/canvas/src/WebGLContextGL.cpp index 6c4fd58acfbb..8b37fd659eca 100644 --- a/content/canvas/src/WebGLContextGL.cpp +++ b/content/canvas/src/WebGLContextGL.cpp @@ -3626,6 +3626,9 @@ WebGLContext::ShaderSource(nsIWebGLShader *sobj, const nsAString& source) if (!GetConcreteObjectAndGLName("shaderSource: shader", sobj, &shader, &shadername)) return NS_OK; + if (!NS_IsAscii(nsPromiseFlatString(source).get())) + return ErrorInvalidValue("shaderSource: non-ascii characters found in source"); + shader->SetSource(NS_LossyConvertUTF16toASCII(source)); shader->SetNeedsTranslation();