mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Always emit INVALID_OPERATION on null element buffers in drawElements
This commit is contained in:
parent
83e27e4167
commit
7b673de4d6
2 changed files with 9 additions and 11 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue