aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglrenderingcontext.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2018-08-25 18:59:49 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2018-08-30 16:15:39 +0200
commit7b673de4d60a9d565343c7d6a1c4ebe436311d2a (patch)
tree236c5f947ab8226c3ebed65dc2c96e64e1c73fcf /components/script/dom/webglrenderingcontext.rs
parent83e27e4167d3fc255708b7839a176cf7ef4ddff6 (diff)
downloadservo-7b673de4d60a9d565343c7d6a1c4ebe436311d2a.tar.gz
servo-7b673de4d60a9d565343c7d6a1c4ebe436311d2a.zip
Always emit INVALID_OPERATION on null element buffers in drawElements
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r--components/script/dom/webglrenderingcontext.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index bb1cace295e..df1b840fc46 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -1165,14 +1165,16 @@ impl WebGLRenderingContext {
return
);
+ let array_buffer = handle_potential_webgl_error!(
+ self,
+ self.current_vao().element_array_buffer().get().ok_or(InvalidOperation),
+ return
+ );
+
if count > 0 && primcount > 0 {
- if let Some(array_buffer) = self.current_vao().element_array_buffer().get() {
- // This operation cannot overflow in u64 and we know all those values are nonnegative.
- let val = offset as u64 + (count as u64 * type_size as u64);
- if val > array_buffer.capacity() as u64 {
- return self.webgl_error(InvalidOperation);
- }
- } else {
+ // This operation cannot overflow in u64 and we know all those values are nonnegative.
+ let val = offset as u64 + (count as u64 * type_size as u64);
+ if val > array_buffer.capacity() as u64 {
return self.webgl_error(InvalidOperation);
}
}