From 1664edb99859d0a9dfb8dc046f6ed922db301f78 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 23 Mar 2012 10:59:03 +0100 Subject: [PATCH] ffmpeg: check samplerate from decoder. Fixes FPE Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- ffmpeg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ffmpeg.c b/ffmpeg.c index 0f6bc30e59..9fd6b4250e 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 */