Patchwork ffmpeg: check samplerate from decoder.

login
register
mail settings
Submitter Michael Niedermayer
Date March 23, 2012, 10:25 a.m.
Message ID <20120323102550.333F3148C8F@albiero.videolan.org>
Download mbox | patch
Permalink /patch/19438/
State New
Headers show

Comments

Michael Niedermayer - March 23, 2012, 10:25 a.m.
ffmpeg | branch: master | Michael Niedermayer <michaelni@gmx.at> | Fri Mar 23 10:59:03 2012 +0100| [1664edb99859d0a9dfb8dc046f6ed922db301f78] | committer: Michael Niedermayer

ffmpeg: check samplerate from decoder.

Fixes FPE

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

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

 ffmpeg.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Patch

diff --git a/ffmpeg.c b/ffmpeg.c
index 0f6bc30..9fd6b42 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2007,6 +2007,10 @@  static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
     if (ret < 0) {
         return ret;
     }
+    if (avctx->sample_rate <= 0) {
+        av_log(avctx, AV_LOG_ERROR, "Sample rate %d invalid\n", avctx->sample_rate);
+        return AVERROR_INVALIDDATA;
+    }
 
     if (!*got_output) {
         /* no audio frame */