aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-28 23:32:39 +0300
committerLuca Barbato <lu_zero@gentoo.org>2013-10-04 03:52:09 +0200
commit607863acaec85671f8c2afd81079ae4c605e3468 (patch)
treeb0aab133ab9a70200494a0d3c0814005c4e52b88
parent04d2f9ace3fb6e880f3488770fc5a39de5b63cbb (diff)
downloadffmpeg-607863acaec85671f8c2afd81079ae4c605e3468.tar.gz
riffdec: Add sanity checks for the sample rate
This avoids a division by zero for G726. 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 d07aa3f02b73ab1371c13ac7898338380ca0932b) Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r--libavformat/riff.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/riff.c b/libavformat/riff.c
index e9463c0973..09d8dbbdb2 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -653,6 +653,11 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
if (size > 0)
avio_skip(pb, size);
}
+ if (codec->sample_rate <= 0) {
+ av_log(NULL, AV_LOG_ERROR,
+ "Invalid sample rate: %d\n", codec->sample_rate);
+ return AVERROR_INVALIDDATA;
+ }
codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample);
if (codec->codec_id == AV_CODEC_ID_AAC_LATM) {
/* channels and sample_rate values are those prior to applying SBR and/or PS */