aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-12-02 21:53:22 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-01-08 23:19:14 +0100
commit49efdb1e77ddc1ff34595336fac83b07512dbabd (patch)
treeab1ef5e76622241ac4d00034f9dd6deb1e6dd721
parent17b3485a6762722c26d6d2ba23b92ea3f87c805b (diff)
downloadffmpeg-49efdb1e77ddc1ff34595336fac83b07512dbabd.tar.gz
avcodec/diracdsp: Fix integer overflow in PUT_SIGNED_RECT_CLAMPED()
Fixes: runtime error: signed integer overflow: 2147483646 + 2048 cannot be represented in type 'int' Fixes: 4479/clusterfuzz-testcase-minimized-6529894147162112 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 610dd74502a58e8bb0f1d8fcbc7015f86b78d70e) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/diracdsp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/diracdsp.c b/libavcodec/diracdsp.c
index 8bc79b788c..2dd56f83f3 100644
--- a/libavcodec/diracdsp.c
+++ b/libavcodec/diracdsp.c
@@ -159,10 +159,10 @@ static void put_signed_rect_clamped_ ## PX ## bit_c(uint8_t *_dst, int dst_strid
int32_t *src = (int32_t *)_src; \
for (y = 0; y < height; y++) { \
for (x = 0; x < width; x+=4) { \
- dst[x ] = av_clip_uintp2(src[x ] + (1 << (PX - 1)), PX); \
- dst[x+1] = av_clip_uintp2(src[x+1] + (1 << (PX - 1)), PX); \
- dst[x+2] = av_clip_uintp2(src[x+2] + (1 << (PX - 1)), PX); \
- dst[x+3] = av_clip_uintp2(src[x+3] + (1 << (PX - 1)), PX); \
+ dst[x ] = av_clip_uintp2(src[x ] + (1U << (PX - 1)), PX); \
+ dst[x+1] = av_clip_uintp2(src[x+1] + (1U << (PX - 1)), PX); \
+ dst[x+2] = av_clip_uintp2(src[x+2] + (1U << (PX - 1)), PX); \
+ dst[x+3] = av_clip_uintp2(src[x+3] + (1U << (PX - 1)), PX); \
} \
dst += dst_stride >> 1; \
src += src_stride >> 2; \