mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
webgl: Throw an error on readPixels(width < 0 || height < 0)
Otherwise gleam will try to allocate a negative size area for the result, and we'll panic with oom.
This commit is contained in:
parent
3277c5281c
commit
9a10666941
1 changed files with 4 additions and 0 deletions
|
@ -1777,6 +1777,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
_ => return Ok(self.webgl_error(InvalidOperation)),
|
||||
}
|
||||
|
||||
if width < 0 || height < 0 {
|
||||
return Ok(self.webgl_error(InvalidValue));
|
||||
}
|
||||
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
self.ipc_renderer
|
||||
.send(CanvasMsg::WebGL(WebGLCommand::ReadPixels(x, y, width, height, format, pixel_type, sender)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue