diff options
author | Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> | 2015-05-06 02:26:57 +0200 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2015-05-31 11:19:22 -0400 |
commit | 0654518597e6ee2947e4a81c26f03f9aec7ef656 (patch) | |
tree | c3c54dc6e45cb306c5349c3e69540a6bf99df267 | |
parent | 3bebca9634f05ea5da7624e3a3f35ec95341e250 (diff) | |
download | ffmpeg-0654518597e6ee2947e4a81c26f03f9aec7ef656.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 a55a70644872027fdf76a75edf12a09c9008880f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-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 e851f0b2fa..0423da27e3 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -569,6 +569,23 @@ static int avi_read_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1); goto fail; } + + 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; ast->frame_offset = ast->cum_len; |