aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-12-19 23:44:53 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-12-20 14:18:04 +0100
commit93eda8dcbadfe375a7fe99592e4097c08deb06d1 (patch)
tree0fc835bf53fc1a1621ba9beb9c1808c6672c5c34
parent1dc135e03d83d14274e3049011396a5bcb36e464 (diff)
downloadffmpeg-93eda8dcbadfe375a7fe99592e4097c08deb06d1.tar.gz
mlvdec: check that index_entries exist
This fixes NULL pointer dereferencing. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> (cherry picked from commit 9fcfe4a3cdf9a5af0c37758b178965b7b99582d4) Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r--libavformat/mlvdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
index 48a429eb23..4b3bdc1eca 100644
--- a/libavformat/mlvdec.c
+++ b/libavformat/mlvdec.c
@@ -365,6 +365,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)