summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2022-08-21 10:32:04 +0200
committersfan5 <sfan5@live.de>2022-08-21 18:38:53 +0200
commit6c1f01d2841281fd594f8ce874b4113640c07553 (patch)
treec45506e076c1c1d2b051d6dd60e6cbd693e24447
parentbf5c19e05b4817bb169f1ad3c4191be2486c2d8e (diff)
downloadmpv-6c1f01d2841281fd594f8ce874b4113640c07553.tar.bz2
mpv-6c1f01d2841281fd594f8ce874b4113640c07553.tar.xz
ao_pipewire: make sure not to exceed the available buffer
The error description in #10545 could indicate that we are overflowing we are corrupting the buffer metadata ourselves through out-of-bound writes. This check is also present in pw-cat so it seems to be expected for b->requested to exceed the actual available buffer space. Potential fix for #10545
-rw-r--r--audio/out/ao_pipewire.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/audio/out/ao_pipewire.c b/audio/out/ao_pipewire.c
index 3421856c44..5384588e1e 100644
--- a/audio/out/ao_pipewire.c
+++ b/audio/out/ao_pipewire.c
@@ -133,7 +133,7 @@ static void on_process(void *userdata)
int nframes = bytes_per_channel / ao->sstride;
#if PW_CHECK_VERSION(0, 3, 49)
if (b->requested != 0)
- nframes = b->requested;
+ nframes = MPMIN(b->requested, nframes);
#endif
for (int i = 0; i < buf->n_datas; i++)