diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 3b72f93265..fd1ecfcf9e 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -545,9 +545,11 @@ static int avi_read_header(AVFormatContext *s) avi->movi_end = avi->fsize; av_log(s, AV_LOG_TRACE, "movi end=%"PRIx64"\n", avi->movi_end); goto end_of_header; - } else if (tag1 == MKTAG('I', 'N', 'F', 'O')) + } else if (tag1 == MKTAG('I', 'N', 'F', 'O')) { + if (size < 4) + return AVERROR_INVALIDDATA; ff_read_riff_info(s, size - 4); - else if (tag1 == MKTAG('n', 'c', 'd', 't')) + } else if (tag1 == MKTAG('n', 'c', 'd', 't')) avi_read_nikon(s, list_end); break;