mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
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@niedermayer.cc>
(cherry picked from commit 3b10bb8772
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
b6af5c8880
commit
29c7a02bb2
@ -575,7 +575,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
else {
|
else {
|
||||||
int32_t sum = (s->version < 2) ? 0 : s->nmean / 2;
|
int32_t sum = (s->version < 2) ? 0 : s->nmean / 2;
|
||||||
for (i = 0; i < s->nmean; i++)
|
for (i = 0; i < s->nmean; i++)
|
||||||
sum += s->offset[channel][i];
|
sum += (unsigned)s->offset[channel][i];
|
||||||
coffset = sum / s->nmean;
|
coffset = sum / s->nmean;
|
||||||
if (s->version >= 2)
|
if (s->version >= 2)
|
||||||
coffset = s->bitshift == 0 ? coffset : coffset >> s->bitshift - 1 >> 1;
|
coffset = s->bitshift == 0 ? coffset : coffset >> s->bitshift - 1 >> 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user