diff options
author | Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> | 2015-05-06 02:26:57 +0200 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-05-14 19:13:13 +0200 |
commit | 0f7e67be3a56e20abcabf9e6698935e6188e7282 (patch) | |
tree | 47497435ecb8259adda67c121f8b3975ba9bce11 | |
parent | 0856eea7707ff142ee6a5b7bb2b59f5de38b720b (diff) | |
download | ffmpeg-0f7e67be3a56e20abcabf9e6698935e6188e7282.tar.gz |
avi: Validate sample_size
And either error out or set it to 0 if it is negative.
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 4d0ee4962be7e07cdc038a78008ef2e4e47e5f81)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Conflicts:
libavformat/avidec.c
-rw-r--r-- | libavformat/avidec.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index fbfd913244..9bb3920827 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -692,6 +692,23 @@ static int avi_read_header(AVFormatContext *s) default: av_log(s, AV_LOG_INFO, "unknown stream type %X\n", tag1); } + + if (ast->sample_size < 0) { + if (s->error_recognition & AV_EF_EXPLODE) { + av_log(s, AV_LOG_ERROR, + "Invalid sample_size %d at stream %d\n", + ast->sample_size, + stream_index); + goto fail; + } + av_log(s, AV_LOG_WARNING, + "Invalid sample_size %d at stream %d " + "setting it to 0\n", + ast->sample_size, + stream_index); + ast->sample_size = 0; + } + if (ast->sample_size == 0) { st->duration = st->nb_frames; if (st->duration > 0 && avi->io_fsize > 0 && avi->riff_end > avi->io_fsize) { |