diff mbox series

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

Message ID 20200928170440.7779-1-jeebjp@gmail.com
State New
Headers show
Series [FFmpeg-devel] avformat/movenc: exit calculate_mpeg4_bit_rates early if track lacks required values | expand

Checks

Context Check Description
andriy/default pending
andriy/make_warn warning New warnings during build
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Jan Ekström Sept. 28, 2020, 5:04 p.m. UTC
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 mbox series

Patch

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,