Skip to content

Commit

Permalink
Validate that a binding offset fits in the buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
nical authored and teoxoy committed Jan 9, 2024
1 parent 58fe7ea commit 37755b6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1832,7 +1832,16 @@ impl<A: HalApi> Device<A> {
}
(size.get(), end)
}
None => (buffer.size - bb.offset, buffer.size),
None => {
if buffer.size < bb.offset {
return Err(Error::BindingRangeTooLarge {
buffer: bb.buffer_id,
range: bb.offset..bb.offset,
size: buffer.size,
});
}
(buffer.size - bb.offset, buffer.size)
}
};

if bind_size > range_limit as u64 {
Expand Down

0 comments on commit 37755b6

Please sign in to comment.