diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-09-27 22:53:24 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-27 23:13:29 +0200 |
commit | 3e0c78bac63c213649c3e8c2fa49e9f3c9848d5a (patch) | |
tree | 933fd35c0850a6a4931e6ab62b25971a759a21cf /libavcodec/imc.c | |
parent | c2d19430290da381c2f95a789a0961199bf5bf8f (diff) | |
download | ffmpeg-3e0c78bac63c213649c3e8c2fa49e9f3c9848d5a.tar.gz |
avcodec/imc: Check flcoeffs5
Fixes infinite loop
Fixes Ticket2996
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/imc.c')
-rw-r--r-- | libavcodec/imc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/imc.c b/libavcodec/imc.c index f4469c4964..a72a6dfed1 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -451,8 +451,13 @@ static int bit_allocation(IMCContext *q, IMCChannel *chctx, for (i = 0; i < BANDS; i++) highest = FFMAX(highest, chctx->flcoeffs1[i]); - for (i = 0; i < BANDS - 1; i++) + for (i = 0; i < BANDS - 1; i++) { + if (chctx->flcoeffs5[i] <= 0) { + av_log(NULL, AV_LOG_ERROR, "flcoeffs5 %f invalid\n", chctx->flcoeffs5[i]); + return AVERROR_INVALIDDATA; + } chctx->flcoeffs4[i] = chctx->flcoeffs3[i] - log2f(chctx->flcoeffs5[i]); + } chctx->flcoeffs4[BANDS - 1] = limit; highest = highest * 0.25; |