aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-28 23:32:39 +0300
committerMartin Storsjö <martin@martin.st>2013-09-29 19:58:18 +0300
commitd07aa3f02b73ab1371c13ac7898338380ca0932b (patch)
treef341784a8135917b83b2be50051f660d074a1597
parent28ff439efd2362fb21e1a78610737f2e26a72d8f (diff)
downloadffmpeg-d07aa3f02b73ab1371c13ac7898338380ca0932b.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>
-rw-r--r--libavformat/riffdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 447a6864b7..74f93acedf 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -120,6 +120,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;
+ }
if (codec->codec_id == AV_CODEC_ID_AAC_LATM) {
/* Channels and sample_rate values are those prior to applying SBR
* and/or PS. */