[FFmpeg-devel] [PATCH] avformat/movenc: exit calculate_mpeg4_bit_rates early if track lacks required values

Jan Ekström jeebjp at gmail.com
Mon Sep 28 20:04:40 EEST 2020


Missed due to lack of FATE tests, but chapters are a movenc track
w/o an AVStream. We also expect the codecpar in the track, which we are
utilizing without checks. Thus, cause an early exit if it is missing
as well.

Fixes #8190
---
 libavformat/movenc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 20768cd45f..a17fa6757c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -641,6 +641,12 @@ struct mpeg4_bit_rate_values {
 
 static struct mpeg4_bit_rate_values calculate_mpeg4_bit_rates(MOVTrack *track)
 {
+    if (!track->st || !track->par)
+        // if there is no AVStream or codecpar available for track, early exit
+        return (struct mpeg4_bit_rate_values) {
+            0
+        };
+
     AVCPBProperties *props =
         (AVCPBProperties*)av_stream_get_side_data(track->st,
                                                   AV_PKT_DATA_CPB_PROPERTIES,
-- 
2.26.2



More information about the ffmpeg-devel mailing list