1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2026-06-19 19:03:00 +02:00

avformat/movenc: initialize all tracks

Fixes: NULL pointer dereference

As a sideeffect this also sets the timescale correctly if an
intermediate matches MOV_TIMESCALE_Q, the previous code stoped
in that case as it could not distinguish it from the overflow detection

Regression since: 51f5f60443

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-06-17 21:11:26 +02:00
committed by James Almer
parent dd6ae3e024
commit c098b07035
+4 -3
View File
@@ -8429,10 +8429,11 @@ static int mov_init(AVFormatContext *s)
track->par = st->codecpar;
}
movie_timescale = av_gcd_q(movie_timescale, st->time_base, INT_MAX, MOV_TIMESCALE_Q);
if (!av_cmp_q(movie_timescale, MOV_TIMESCALE_Q))
break;
movie_timescale = av_gcd_q(movie_timescale, st->time_base, INT_MAX, (AVRational){1,0});
}
if (!movie_timescale.den)
movie_timescale = MOV_TIMESCALE_Q;
if (!mov->movie_timescale)
mov->movie_timescale = FFMAX(movie_timescale.den, MOV_TIMESCALE);