diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2013-07-09 09:18:16 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-22 12:16:19 +0200 |
commit | f33d5af1f35e1f1fd83648d321b489c9006525c9 (patch) | |
tree | 99699a89690486eb7e34af60c93acc214d0932cb | |
parent | 93c524c0f0faf90ed99fcc2ac183a1de2cfda5f6 (diff) | |
download | ffmpeg-f33d5af1f35e1f1fd83648d321b489c9006525c9.tar.gz |
imc: Catch a division by zero
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bbf6a4aa20bfe3d7869b2218e66063602dfb8aa7)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Conflicts:
libavcodec/imc.c
-rw-r--r-- | libavcodec/imc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/imc.c b/libavcodec/imc.c index d3b8bf5a12..0c2b4b4a83 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -365,6 +365,10 @@ static int bit_allocation (IMCContext* q, int stream_format_code, int freebits, iacc += q->bandWidthT[i]; summa += q->bandWidthT[i] * q->flcoeffs4[i]; } + + if (!iacc) + return AVERROR_INVALIDDATA; + q->bandWidthT[BANDS-1] = 0; summa = (summa * 0.5 - freebits) / iacc; |