aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dirac_dwt_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-06-14 16:37:32 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-06-18 01:16:04 +0200
commitd946e7b805e21e62a69e1e290d98a494db863e69 (patch)
tree699b2f9db6310fa1644eb1836b8278489cc00290 /libavcodec/dirac_dwt_template.c
parent84d473a9cfc61c4b4f1557f41462d02088b94614 (diff)
downloadffmpeg-d946e7b805e21e62a69e1e290d98a494db863e69.tar.gz
avcodec/dirac_dwt_template: Fix undefined behavior in interleave()
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 8697/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5197148130902016 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 575d8ca0260fabac29e5b3541154633569ce2b5d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/dirac_dwt_template.c')
-rw-r--r--libavcodec/dirac_dwt_template.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/dirac_dwt_template.c b/libavcodec/dirac_dwt_template.c
index 8c25c1f822..528fc7e9e7 100644
--- a/libavcodec/dirac_dwt_template.c
+++ b/libavcodec/dirac_dwt_template.c
@@ -57,8 +57,8 @@ static av_always_inline void RENAME(interleave)(TYPE *dst, TYPE *src0, TYPE *src
{
int i;
for (i = 0; i < w2; i++) {
- dst[2*i ] = (src0[i] + add) >> shift;
- dst[2*i+1] = (src1[i] + add) >> shift;
+ dst[2*i ] = (src0[i] + (unsigned)add) >> shift;
+ dst[2*i+1] = (src1[i] + (unsigned)add) >> shift;
}
}