[FFmpeg-cvslog] mlvdec: check that index_entries exist

Andreas Cadhalpun git at videolan.org
Sun Dec 20 15:24:16 CET 2015


ffmpeg | branch: release/2.6 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sat Dec 19 23:44:53 2015 +0100| [c51800d324a9a86dcc84a57d29fff8f9d8f5b1e3] | committer: Andreas Cadhalpun

mlvdec: check that index_entries exist

This fixes NULL pointer dereferencing.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
(cherry picked from commit 9fcfe4a3cdf9a5af0c37758b178965b7b99582d4)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c51800d324a9a86dcc84a57d29fff8f9d8f5b1e3
---

 libavformat/mlvdec.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
index 4ab08e5..4416814 100644
--- a/libavformat/mlvdec.c
+++ b/libavformat/mlvdec.c
@@ -358,6 +358,11 @@ static int read_header(AVFormatContext *avctx)
     if (ast)
         ast->duration = ast->nb_index_entries;
 
+    if ((vst && !vst->nb_index_entries) || (ast && !ast->nb_index_entries)) {
+        av_log(avctx, AV_LOG_ERROR, "no index entries found\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     if (vst && ast)
         avio_seek(pb, FFMIN(vst->index_entries[0].pos, ast->index_entries[0].pos), SEEK_SET);
     else if (vst)



More information about the ffmpeg-cvslog mailing list