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

Martin Storsjö git at videolan.org
Sun Sep 29 23:45:38 CEST 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sat Sep 28 23:32:39 2013 +0300| [d07aa3f02b73ab1371c13ac7898338380ca0932b] | committer: Martin Storsjö

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>

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

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

diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 447a686..74f93ac 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. */



More information about the ffmpeg-cvslog mailing list