mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
webgl: Fix out-of-bounds readpixels handling.
This fixes the crash in read-pixels-pack-alignment (which was trying to read out of bounds). Fixes #13901
This commit is contained in:
parent
9a10666941
commit
5e5eb18b0b
5 changed files with 122 additions and 21 deletions
|
@ -33,6 +33,7 @@ pub struct WebGLFramebuffer {
|
|||
/// target can only be gl::FRAMEBUFFER at the moment
|
||||
target: Cell<Option<u32>>,
|
||||
is_deleted: Cell<bool>,
|
||||
size: Cell<Option<(i32, i32)>>,
|
||||
status: Cell<u32>,
|
||||
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
||||
renderer: IpcSender<CanvasMsg>,
|
||||
|
@ -55,6 +56,7 @@ impl WebGLFramebuffer {
|
|||
target: Cell::new(None),
|
||||
is_deleted: Cell::new(false),
|
||||
renderer: renderer,
|
||||
size: Cell::new(None),
|
||||
status: Cell::new(constants::FRAMEBUFFER_UNSUPPORTED),
|
||||
color: DOMRefCell::new(None),
|
||||
depth: DOMRefCell::new(None),
|
||||
|
@ -110,6 +112,10 @@ impl WebGLFramebuffer {
|
|||
self.is_deleted.get()
|
||||
}
|
||||
|
||||
pub fn size(&self) -> Option<(i32, i32)> {
|
||||
self.size.get()
|
||||
}
|
||||
|
||||
fn update_status(&self) {
|
||||
let c = self.color.borrow();
|
||||
let z = self.depth.borrow();
|
||||
|
@ -165,6 +171,7 @@ impl WebGLFramebuffer {
|
|||
}
|
||||
}
|
||||
}
|
||||
self.size.set(fb_size);
|
||||
|
||||
if has_c || has_z || has_zs || has_s {
|
||||
self.status.set(constants::FRAMEBUFFER_COMPLETE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue