diff mbox

[FFmpeg-devel] avcodec/diracdec: Fix integer overflow in signed multiplication in UNPACK_ARITH()

Message ID 20170726194930.14739-1-michael@niedermayer.cc
State Accepted
Commit 8e275a74b09cc87f4334ed572f919b7647d4bea1
Headers show

Commit Message

Michael Niedermayer July 26, 2017, 7:49 p.m. UTC
Fixes: runtime error: signed integer overflow: 1073741823 * 4 cannot be represented in type 'int'
Fixes: 2729/clusterfuzz-testcase-minimized-5902915464069120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/diracdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer July 28, 2017, 1:22 a.m. UTC | #1
On Wed, Jul 26, 2017 at 09:49:30PM +0200, Michael Niedermayer wrote:
> Fixes: runtime error: signed integer overflow: 1073741823 * 4 cannot be represented in type 'int'
> Fixes: 2729/clusterfuzz-testcase-minimized-5902915464069120
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/diracdec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

applied

[...]
diff mbox

Patch

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 71d0ff41b2..d2262ebbf5 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -454,7 +454,8 @@  static inline int coeff_unpack_golomb(GetBitContext *gb, int qfactor, int qoffse
     static inline void coeff_unpack_arith_##n(DiracArith *c, int qfactor, int qoffset, \
                                               SubBand *b, type *buf, int x, int y) \
     { \
-        int coeff, sign, sign_pred = 0, pred_ctx = CTX_ZPZN_F1; \
+        int sign, sign_pred = 0, pred_ctx = CTX_ZPZN_F1; \
+        unsigned coeff; \
         const int mstride = -(b->stride >> (1+b->pshift)); \
         if (b->parent) { \
             const type *pbuf = (type *)b->parent->ibuf; \