fix(portal): reject frames before format negotiation to prevent zero-dimension encoder init
This commit is contained in:
@@ -326,15 +326,21 @@ fn pipewire_thread(ctx: PwThreadCtx) {
|
||||
pts_val
|
||||
};
|
||||
|
||||
let Some((width, height, format, modifier)) = format_info.get() else {
|
||||
unsafe { stream.queue_raw_buffer(raw_buf) };
|
||||
return;
|
||||
};
|
||||
if width == 0 || height == 0 || format == 0 {
|
||||
unsafe { stream.queue_raw_buffer(raw_buf) };
|
||||
return;
|
||||
}
|
||||
|
||||
let dup_fd = unsafe { libc::dup(fd) };
|
||||
if dup_fd < 0 {
|
||||
unsafe { stream.queue_raw_buffer(raw_buf) };
|
||||
return;
|
||||
}
|
||||
|
||||
let (width, height, format, modifier) =
|
||||
format_info.get().unwrap_or((0, 0, 0, 0));
|
||||
|
||||
let frame = PwDmaBufFrame {
|
||||
fd: unsafe { OwnedFd::from_raw_fd(dup_fd) },
|
||||
offset,
|
||||
|
||||
Reference in New Issue
Block a user