Hi,

ticket #3868 is about a fuzzed file containing a weird sampling rate.
"richardpl" (?) suggestion is perfectly fine in my opinion.

I didn't put one, but don't hesitate to put the proper "-by".

-- 
Christophe
From 412a719ac4ab830ddc35b3d7e99fab2ccb543279 Mon Sep 17 00:00:00 2001
From: Christophe Gisquet <christophe.gisq...@gmail.com>
Date: Thu, 21 Aug 2014 12:21:07 +0200
Subject: [PATCH] imc: reject files with unfathomable sampling rates

With huge sampling rates, the table derivation method does not converge fast
enough. While fixing it using e.g. Newton-Rhapson-like methods (the curve is
nicely convex) is possible, it is much simpler to reject these cases.

The value of 96000 was arbitrarily chosen as a realistic value, though
1000000 would still work and converge.

Fixes ticket #3868.
---
 libavcodec/imc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index e6a087a..0df0dd1 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -180,6 +180,14 @@ static av_cold int imc_decode_init(AVCodecContext *avctx)
     IMCContext *q = avctx->priv_data;
     double r1, r2;
 
+    if (avctx->codec_id == AV_CODEC_ID_IAC && avctx->sample_rate > 96000) {
+        av_log(avctx, AV_LOG_ERROR,
+               "Strange sample rate of %i, file likely corrupt or "
+               "needing a new table derivation method.\n",
+               avctx->sample_rate);
+        return AVERROR_PATCHWELCOME;
+    }
+
     if (avctx->codec_id == AV_CODEC_ID_IMC)
         avctx->channels = 1;
 
-- 
1.9.2.msysgit.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to