[FFmpeg-cvslog] vqf: Make sure sample_rate is set to a valid value

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


ffmpeg | branch: release/0.10 | Martin Storsjö <martin at martin.st> | Sat Sep 28 00:34:35 2013 +0300| [61d56054a9d792882f18b0e6bfb6834a793efe2f] | committer: Luca Barbato

vqf: Make sure sample_rate is set to a valid value

This avoids divisions by zero later (and possibly assertions in
time base scaling), since an invalid rate_flag combined with an
invalid bitrate below could pass the mode combination test.

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 9277050e2918e0a0df9689721a188a604d886616)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
(cherry picked from commit 4d60ab62e05decc562645cd6f813f7c9e69637ee)

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

 libavformat/vqf.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index 4f8f07c..a9b5ce7 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -174,6 +174,10 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
         st->codec->sample_rate = 11025;
         break;
     default:
+        if (rate_flag < 8 || rate_flag > 44) {
+            av_log(s, AV_LOG_ERROR, "Invalid rate flag %d\n", rate_flag);
+            return AVERROR_INVALIDDATA;
+        }
         st->codec->sample_rate = rate_flag*1000;
         break;
     }



More information about the ffmpeg-cvslog mailing list