aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-01-07 20:58:49 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-01-08 23:19:15 +0100
commit1ab3e34cb44c34d9824c6b3f61a1f55007b49d40 (patch)
treefc967678a97e91c45aa4c89249988e3ebeef0d69 /libavcodec
parenta9fb75893bc7b8033f629b336e30ec06b819fd0e (diff)
downloadffmpeg-1ab3e34cb44c34d9824c6b3f61a1f55007b49d40.tar.gz
avcodec/dirac_dwt: Fix overflows in COMPOSE_HAARiH0/COMPOSE_HAARiL0
Fixes: 4830/clusterfuzz-testcase-minimized-5255392054476800 Fixes: signed integer overflow: 2147483646 - -7 cannot be represented in type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 0e62a2373475f58c72c0faf5568be00b26909585) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dirac_dwt.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/dirac_dwt.h b/libavcodec/dirac_dwt.h
index f9828d95a4..1af41e0702 100644
--- a/libavcodec/dirac_dwt.h
+++ b/libavcodec/dirac_dwt.h
@@ -105,10 +105,10 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y);
(int)(((unsigned)(b2) - ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 16) >> 5)))
#define COMPOSE_HAARiL0(b0, b1)\
- (b0 - ((b1 + 1) >> 1))
+ ((int)(b0 - (unsigned)((int)(b1 + 1U) >> 1)))
#define COMPOSE_HAARiH0(b0, b1)\
- (b0 + b1)
+ ((int)(b0 + (unsigned)(b1)))
#define COMPOSE_FIDELITYiL0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
((unsigned)b4 - ((int)(-8*(b0+(unsigned)b8) + 21*(b1+(unsigned)b7) - 46*(b2+(unsigned)b6) + 161*(b3+(unsigned)b5) + 128) >> 8))