From 4b9f3c4323d29af0e55222265fc92680c6480aec Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 22 Oct 2019 14:54:09 +0200 Subject: [PATCH] avformat/mpeg: Don't use unintialized value vobsub_read_packet() didn't check whether an array of AVPackets was valid and therefore used uninitialized values. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Rheinhardt (cherry picked from commit a39536caee6607f481e9075bfb11937f46a47489) --- libavformat/mpeg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index d10dd45d5b..ff85ad54ee 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -915,6 +915,10 @@ static int vobsub_read_packet(AVFormatContext *s, AVPacket *pkt) FFDemuxSubtitlesQueue *tmpq = &vobsub->q[i]; int64_t ts; av_assert0(tmpq->nb_subs); + + if (tmpq->current_sub_idx >= tmpq->nb_subs) + continue; + ts = tmpq->subs[tmpq->current_sub_idx].pts; if (ts < min_ts) { min_ts = ts;