[FFmpeg-cvslog] riffdec: Add sanity checks for the sample rate

Martin Storsjö git at videolan.org
Thu Jan 16 22:29:50 CET 2014


ffmpeg | branch: release/0.10 | Martin Storsjö <martin at martin.st> | Sat Sep 28 23:32:39 2013 +0300| [7fdb915fc712f43879a396015b6fc56e40e89b35] | committer: Luca Barbato

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 at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit d07aa3f02b73ab1371c13ac7898338380ca0932b)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
(cherry picked from commit 607863acaec85671f8c2afd81079ae4c605e3468)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7fdb915fc712f43879a396015b6fc56e40e89b35
---

 libavformat/riff.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/riff.c b/libavformat/riff.c
index 4caac80..2594bd2 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -563,6 +563,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 == CODEC_ID_AAC_LATM) {
         /* channels and sample_rate values are those prior to applying SBR and/or PS */



More information about the ffmpeg-cvslog mailing list