Skip to content

Commit b351c21

Browse files
committed
add another array length check
missed in previous version.
1 parent 0ee554f commit b351c21

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pulse-binding/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# <unreleased>
2+
3+
* Added a length check to the stream restore `write()` method (missed in previous version).
4+
15
# 2.30.0 (April 19th, 2025)
26

37
* Added `to_owned()` methods to a bunch of introspection objects (as requested back in 2021 in

pulse-binding/src/context/ext_stream_restore.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,13 @@ impl StreamRestore {
139139
///
140140
/// The callback must accept a `bool`, which indicates success.
141141
///
142-
/// Panics if the underlying C function returns a null pointer.
142+
/// Panics if the underlying C function returns a null pointer, or if the length of the array is
143+
/// too long to be communicated to the C function.
143144
pub fn write<F>(&mut self, mode: proplist::UpdateMode, data: &[&Info],
144145
apply_immediately: bool, callback: F) -> Operation<dyn FnMut(bool)>
145146
where F: FnMut(bool) + 'static
146147
{
148+
assert!(data.len() <= u32::MAX as usize);
147149
let cb_data = box_closure_get_capi_ptr::<dyn FnMut(bool)>(Box::new(callback));
148150
let ptr = unsafe {
149151
capi::pa_ext_stream_restore_write(self.context, mode, mem::transmute(data.as_ptr()),

0 commit comments

Comments
 (0)