diff options
author | Martin Storsjö <martin@martin.st> | 2013-09-19 16:02:29 +0300 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2014-01-07 09:43:57 +0100 |
commit | e80071892b14a66b8730dfe21aca76e5b0333f2d (patch) | |
tree | 5de8da665d46b676c8d7e699e8ae9800f7aeb557 | |
parent | 2c3114158510d05346e362d381a3b352175e260e (diff) | |
download | ffmpeg-e80071892b14a66b8730dfe21aca76e5b0333f2d.tar.gz |
segafilm: Validate the number of audio channels
This avoids divisions by zero later.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 82e266c6d3fbf3cc74e515b883e66543381a0f2c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 5379c5184b9fe9ef06234638f5629d4c80056e04)
-rw-r--r-- | libavformat/segafilm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 5279121383..d5aaf11d38 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -112,6 +112,11 @@ static int film_read_header(AVFormatContext *s, return AVERROR(EIO); film->audio_samplerate = AV_RB16(&scratch[24]); film->audio_channels = scratch[21]; + if (!film->audio_channels || film->audio_channels > 2) { + av_log(s, AV_LOG_ERROR, + "Invalid number of channels: %d\n", film->audio_channels); + return AVERROR_INVALIDDATA; + } film->audio_bits = scratch[22]; if (scratch[23] == 2) film->audio_type = CODEC_ID_ADPCM_ADX; |