[FFmpeg-cvslog] avdevice/pulse_audio_dec: query actual fragment size

Marton Balint git at videolan.org
Sat Mar 13 01:15:16 EET 2021


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Wed Feb 10 00:15:00 2021 +0100| [104aa921c96f126c49259c946e995679cec3abd6] | committer: Marton Balint

avdevice/pulse_audio_dec: query actual fragment size

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=104aa921c96f126c49259c946e995679cec3abd6
---

 libavdevice/pulse_audio_dec.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavdevice/pulse_audio_dec.c b/libavdevice/pulse_audio_dec.c
index 50a3c971ae..6dea332beb 100644
--- a/libavdevice/pulse_audio_dec.c
+++ b/libavdevice/pulse_audio_dec.c
@@ -149,6 +149,7 @@ static av_cold int pulse_read_header(AVFormatContext *s)
 
     pa_buffer_attr attr = { -1 };
     pa_channel_map cmap;
+    const pa_buffer_attr *queried_attr;
 
     pa_channel_map_init_extend(&cmap, pd->channels, PA_CHANNEL_MAP_WAVEEX);
 
@@ -242,6 +243,14 @@ static av_cold int pulse_read_header(AVFormatContext *s)
         pa_threaded_mainloop_wait(pd->mainloop);
     }
 
+    /* Query actual fragment size */
+    queried_attr = pa_stream_get_buffer_attr(pd->stream);
+    if (!queried_attr || queried_attr->fragsize > INT_MAX/100) {
+        ret = AVERROR_EXTERNAL;
+        goto unlock_and_fail;
+    }
+    pd->fragment_size = queried_attr->fragsize;
+
     pa_threaded_mainloop_unlock(pd->mainloop);
 
     /* take real parameters */



More information about the ffmpeg-cvslog mailing list