Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-01-07 05:48:43 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2018-01-28 17:33:09 +0300
commit4715ef27a068df8c7c3d3b2e40ba1617dbafd5b8 (patch)
tree2726a0ffab27111e609b8eab2a15128c0fd440b8 /libavcodec/h264addpx_template.c
parent8263246ba8f627d8cfeefb3a83d062989e507e77 (diff)
avcodec/h264addpx_template: Fixes integer overflows
Fixes: signed integer overflow: 512 + 2147483491 cannot be represented in type 'int' Fixes: 4780/clusterfuzz-testcase-minimized-4709066174627840 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 d6945aeee419a8417b8019c7c92227e12e45b7ad) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/h264addpx_template.c')
-rw-r--r--libavcodec/h264addpx_template.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/h264addpx_template.c b/libavcodec/h264addpx_template.c
index b71aaea439..9a1e6a2f2f 100644
--- a/libavcodec/h264addpx_template.c
+++ b/libavcodec/h264addpx_template.c
@@ -35,10 +35,10 @@ static void FUNCC(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src, int stride)
stride /= sizeof(pixel);
for (i = 0; i < 4; i++) {
- dst[0] += src[0];
- dst[1] += src[1];
- dst[2] += src[2];
- dst[3] += src[3];
+ dst[0] += (unsigned)src[0];
+ dst[1] += (unsigned)src[1];
+ dst[2] += (unsigned)src[2];
+ dst[3] += (unsigned)src[3];
dst += stride;
src += 4;
@@ -55,14 +55,14 @@ static void FUNCC(ff_h264_add_pixels8)(uint8_t *_dst, int16_t *_src, int stride)
stride /= sizeof(pixel);
for (i = 0; i < 8; i++) {
- dst[0] += src[0];
- dst[1] += src[1];
- dst[2] += src[2];
- dst[3] += src[3];
- dst[4] += src[4];
- dst[5] += src[5];
- dst[6] += src[6];
- dst[7] += src[7];
+ dst[0] += (unsigned)src[0];
+ dst[1] += (unsigned)src[1];
+ dst[2] += (unsigned)src[2];
+ dst[3] += (unsigned)src[3];
+ dst[4] += (unsigned)src[4];
+ dst[5] += (unsigned)src[5];
+ dst[6] += (unsigned)src[6];
+ dst[7] += (unsigned)src[7];
dst += stride;
src += 8;