[FFmpeg-cvslog] avcodec/diracdec: Fix integer overflow with quant
Michael Niedermayer
git at videolan.org
Thu Feb 1 01:52:55 EET 2018
ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jan 7 20:43:24 2018 +0100| [c65c4c475975ced7e296fc68946d97c64f8077fb] | committer: Michael Niedermayer
avcodec/diracdec: Fix integer overflow with quant
Fixes: signed integer overflow: 2 + 2147483646 cannot be represented in type 'int'
Fixes: 4792/clusterfuzz-testcase-minimized-6322450775146496
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit eaa93175895568ef6c2542b13104874907d9c4ef)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c65c4c475975ced7e296fc68946d97c64f8077fb
---
libavcodec/diracdec.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index ba7f8ee7eb..7c7a31e830 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -532,16 +532,16 @@ static inline void codeblock(DiracContext *s, SubBand *b,
}
if (s->codeblock_mode && !(s->old_delta_quant && blockcnt_one)) {
- int quant = b->quant;
+ int quant;
if (is_arith)
- 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
- quant += dirac_get_se_golomb(gb);
- if (quant < 0) {
+ quant = dirac_get_se_golomb(gb);
+ if (quant > INT_MAX - b->quant || b->quant + quant < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid quant\n");
return;
}
- b->quant = quant;
+ b->quant += quant;
}
b->quant = FFMIN(b->quant, MAX_QUANT);
More information about the ffmpeg-cvslog
mailing list