mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-22 08:07:07 +00:00
gstreamer: bufferlist: Check index/length when removing a buffer
Out of range values give assertions in the C function. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1444>
This commit is contained in:
parent
9f151466b7
commit
a0e58ec359
1 changed files with 4 additions and 0 deletions
|
@ -44,6 +44,10 @@ impl BufferListRef {
|
|||
|
||||
#[doc(alias = "gst_buffer_list_remove")]
|
||||
pub fn remove(&mut self, idx: u32, len: u32) {
|
||||
let n = self.len() as u32;
|
||||
assert!(idx < n);
|
||||
assert!(idx.checked_add(len).unwrap() <= n);
|
||||
|
||||
unsafe { ffi::gst_buffer_list_remove(self.as_mut_ptr(), idx, len) }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue