avformat/imfdec: Simplify get_next_track_with_minimum_timestamp()

This also makes the code more robust

Fixes: CID1512414 Uninitialized pointer read

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-06-03 00:16:18 +02:00
parent c21fb3624b
commit f10493f6fc
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 1 additions and 4 deletions

View File

@ -695,12 +695,9 @@ static int imf_read_header(AVFormatContext *s)
static IMFVirtualTrackPlaybackCtx *get_next_track_with_minimum_timestamp(AVFormatContext *s)
{
IMFContext *c = s->priv_data;
IMFVirtualTrackPlaybackCtx *track;
IMFVirtualTrackPlaybackCtx *track = NULL;
AVRational minimum_timestamp = av_make_q(INT32_MAX, 1);
if (!c->track_count)
return NULL;
for (uint32_t i = c->track_count; i > 0; i--) {
av_log(s, AV_LOG_TRACE, "Compare track %d timestamp " AVRATIONAL_FORMAT
" to minimum " AVRATIONAL_FORMAT