diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-29 05:04:25 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-16 15:59:30 +0100 |
commit | 0be85fd80f4dba6d4b2d14590ab8921f6707a289 (patch) | |
tree | 20bc8c2293e69671a31407fbfeac341e817821b8 /libavcodec/diracdec.c | |
parent | 9f253ebb41c5365edc406bf73bf1c483befc6ee4 (diff) | |
download | ffmpeg-0be85fd80f4dba6d4b2d14590ab8921f6707a289.tar.gz |
diracdec: Check for negative quants which would cause out of array reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5cd8afee99c83b62e1474f122d947de7e4ad9ff5)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/diracdec.c')
-rw-r--r-- | libavcodec/diracdec.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index c96b37aa4e..049f7592ca 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -491,10 +491,16 @@ static inline void codeblock(DiracContext *s, SubBand *b, } if (s->codeblock_mode && !(s->old_delta_quant && blockcnt_one)) { + int quant = b->quant; if (is_arith) - b->quant += dirac_get_arith_int(c, CTX_DELTA_Q_F, CTX_DELTA_Q_DATA); + quant += dirac_get_arith_int(c, CTX_DELTA_Q_F, CTX_DELTA_Q_DATA); else - b->quant += dirac_get_se_golomb(gb); + quant += dirac_get_se_golomb(gb); + if (quant < 0) { + av_log(s->avctx, AV_LOG_ERROR, "Invalid quant\n"); + return; + } + b->quant = quant; } b->quant = FFMIN(b->quant, MAX_QUANT); |