Browse Source

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 9fcfe4a3cd)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
tags/n2.4.13
Andreas Cadhalpun 10 years ago
parent
commit
f0eea9cc3a
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      libavformat/mlvdec.c

+ 5
- 0
libavformat/mlvdec.c View File

@@ -363,6 +363,11 @@ static int read_header(AVFormatContext *avctx)
if (ast) if (ast)
ast->duration = ast->nb_index_entries; 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) if (vst && ast)
avio_seek(pb, FFMIN(vst->index_entries[0].pos, ast->index_entries[0].pos), SEEK_SET); avio_seek(pb, FFMIN(vst->index_entries[0].pos, ast->index_entries[0].pos), SEEK_SET);
else if (vst) else if (vst)


Loading…
Cancel
Save