Skip to content

Commit 3f6fa10

Browse files
committed
yet add another array length check
missed in previous version.
1 parent b351c21 commit 3f6fa10

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

pulse-binding/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# <unreleased>
22

3+
* Added a length check to the stream `new_extended()` method (missed in previous version).
34
* Added a length check to the stream restore `write()` method (missed in previous version).
45

56
# 2.30.0 (April 19th, 2025)

pulse-binding/src/stream.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,8 @@ impl Stream {
603603
/// While connecting, the server will select the most appropriate format which the client must
604604
/// then provide.
605605
///
606+
/// Will panic if the `formats` array is longer than can be communicated to the C function.
607+
///
606608
/// # Params
607609
///
608610
/// * `ctx`: The context to create this stream in
@@ -612,6 +614,7 @@ impl Stream {
612614
pub fn new_extended(ctx: &mut Context, name: &str, formats: &[&format::Info],
613615
proplist: &mut Proplist) -> Option<Self>
614616
{
617+
assert!(formats.len() <= u32::MAX as usize);
615618
// Warning: New CStrings will be immediately freed if not bound to a variable, leading to
616619
// as_ptr() giving dangling pointers!
617620
let c_name = CString::new(name).unwrap();

0 commit comments

Comments
 (0)