From 4b5b3c3adb11b7eb8c123bc67ae5e852589ce18f Mon Sep 17 00:00:00 2001 From: Josh Abraham Date: Sat, 17 Nov 2018 08:18:12 -0500 Subject: [PATCH] Add GetShaderPrecisionFormat argument validation This patch adds a check on the shader_type argument. If it is not one either FRAGMENT_SHADER or VERTEX_SHADER, we return INVALID_ENUM. --- components/script/dom/webglrenderingcontext.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index a129a05fcfd..3b1ea63088e 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -2588,6 +2588,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { shader_type: u32, precision_type: u32, ) -> Option> { + match shader_type { + constants::FRAGMENT_SHADER | constants::VERTEX_SHADER => (), + _ => { + self.webgl_error(InvalidEnum); + return None; + }, + } + match precision_type { constants::LOW_FLOAT | constants::MEDIUM_FLOAT |