summaryrefslogtreecommitdiff
path: root/libavcodec/imc.c
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@gmail.com>2014-08-21 12:21:07 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-21 14:20:46 +0200
commit4728cdd88033c2bd41ae675d7df9aaf3f578136b (patch)
tree306e9a2d2fa6e40845dfba1e022ef1073c7f1462 /libavcodec/imc.c
parentb09ea25fec615c871ab8bfb00c3863aa0ce0d2c9 (diff)
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. Suggested-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/imc.c')
-rw-r--r--libavcodec/imc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index e6a087ada1..0df0dd1a68 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;