[FFmpeg-cvslog] oggparsespeex: validate sample_rate

Andreas Cadhalpun git at videolan.org
Mon Nov 7 01:54:01 EET 2016


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sun Oct 23 17:12:49 2016 +0200| [eb205eda3fec9959037c419548b1ebfaa6c59c33] | committer: Andreas Cadhalpun

oggparsespeex: validate sample_rate

A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

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

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

diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c
index 434b0fd..2b49150 100644
--- a/libavformat/oggparsespeex.c
+++ b/libavformat/oggparsespeex.c
@@ -68,6 +68,10 @@ static int speex_header(AVFormatContext *s, int idx) {
         }
 
         st->codecpar->sample_rate = AV_RL32(p + 36);
+        if (st->codecpar->sample_rate <= 0) {
+            av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate);
+            return AVERROR_INVALIDDATA;
+        }
         st->codecpar->channels = AV_RL32(p + 48);
         if (st->codecpar->channels < 1 || st->codecpar->channels > 2) {
             av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n");



More information about the ffmpeg-cvslog mailing list