diff options
author | Eric Anholt <eric@anholt.net> | 2016-08-14 00:14:54 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2016-11-05 11:49:30 -0700 |
commit | 5e5eb18b0b48f008768487dd9dc0fd1c8b1adf18 (patch) | |
tree | cd77cd2dd7eab35c470836e3229c7a92ac2231bb /components/script/dom/webglframebuffer.rs | |
parent | 9a10666941ea4bbec03205609d1b578a749251c6 (diff) | |
download | servo-5e5eb18b0b48f008768487dd9dc0fd1c8b1adf18.tar.gz servo-5e5eb18b0b48f008768487dd9dc0fd1c8b1adf18.zip |
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
Diffstat (limited to 'components/script/dom/webglframebuffer.rs')
-rw-r--r-- | components/script/dom/webglframebuffer.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs index 8586b09d5bf..ef40fecac19 100644 --- a/components/script/dom/webglframebuffer.rs +++ b/components/script/dom/webglframebuffer.rs @@ -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); |