Validate that a binding offset fits in the buffer

This commit is contained in:
Nicolas Silva 2024-01-09 14:50:30 +01:00 committed by Teodor Tanasoaia
parent 58fe7eac48
commit 37755b6985

View File

@ -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 {