[FFmpeg-cvslog] avcodec/shorten: Fix undefined addition in shorten_decode_frame()

Michael Niedermayer git at videolan.org
Sat Jul 7 19:13:48 EEST 2018


ffmpeg | branch: release/3.4 | Michael Niedermayer <michael at niedermayer.cc> | Mon Jul  2 19:11:46 2018 +0200| [4ca95e64db794245b37d1685855bfdd6b0914964] | committer: Michael Niedermayer

avcodec/shorten: Fix undefined addition in shorten_decode_frame()

Fixes: signed integer overflow: 1139785606 + 1454196085 cannot be represented in type 'int'
Fixes: 8937/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-6202943597445120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 3b10bb8772c76177cc47b8d15a6970f19dd11039)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ca95e64db794245b37d1685855bfdd6b0914964
---

 libavcodec/shorten.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 79656e7757..0f491090fd 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -682,7 +682,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
             else {
                 int32_t sum = (s->version < 2) ? 0 : s->nmean / 2;
                 for (i = 0; i < s->nmean; i++)
-                    sum += s->offset[channel][i];
+                    sum += (unsigned)s->offset[channel][i];
                 coffset = sum / s->nmean;
                 if (s->version >= 2)
                     coffset = s->bitshift == 0 ? coffset : coffset >> s->bitshift - 1 >> 1;



More information about the ffmpeg-cvslog mailing list