mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
webgl: Validate shader type parameter to CreateShader.
This commit is contained in:
parent
8b32e63db8
commit
240ac7cfe2
1 changed files with 7 additions and 0 deletions
|
@ -679,6 +679,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||
fn CreateShader(&self, shader_type: u32) -> Option<Root<WebGLShader>> {
|
||||
match shader_type {
|
||||
constants::VERTEX_SHADER | constants::FRAGMENT_SHADER => {},
|
||||
_ => {
|
||||
self.webgl_error(InvalidEnum);
|
||||
return None;
|
||||
}
|
||||
}
|
||||
WebGLShader::maybe_new(self.global().r(), self.ipc_renderer.clone(), shader_type)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue