1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

avcodec/dpcm: fix undefined interger overflow in wady

Fixes: signed integer overflow: -2147375930 + -133875 cannot be represented in type 'int'
Fixes: 45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WADY_DPCM_fuzzer-6703727013920768

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 8f0e200a12c25e288acd31eff0a5000bc74aa34e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2023-04-16 17:45:41 +02:00
parent 40e81d5a8b
commit 838cab9a07
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -444,7 +444,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (n & 0x80)
s->sample[idx] = sign_extend((n & 0x7f) << 9, 16);
else
s->sample[idx] += s->scale * wady_table[n & 0x7f];
s->sample[idx] += s->scale * (unsigned)wady_table[n & 0x7f];
*output_samples++ = av_clip_int16(s->sample[idx]);
idx ^= stereo;
}