avcodec/flacdec: Fix overflow in "33bit" decorrelate

Fixes: signed integer overflow: 538976288 - -9223372036854775808 cannot be represented in type 'long'
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-6275845531238400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/390/head
Michael Niedermayer 1 year ago
parent d11b8bd0c6
commit 35e6960a6b
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 4
      libavcodec/flacdec.c

@ -706,10 +706,10 @@ static void decorrelate_33bps(int ch_mode, int32_t **decoded, int64_t *decoded_3
int i;
if (ch_mode == FLAC_CHMODE_LEFT_SIDE ) {
for (i = 0; i < len; i++)
decoded[1][i] = decoded[0][i] - decoded_33bps[i];
decoded[1][i] = decoded[0][i] - (uint64_t)decoded_33bps[i];
} else if (ch_mode == FLAC_CHMODE_RIGHT_SIDE ) {
for (i = 0; i < len; i++)
decoded[0][i] = decoded[1][i] + decoded_33bps[i];
decoded[0][i] = decoded[1][i] + (uint64_t)decoded_33bps[i];
} else if (ch_mode == FLAC_CHMODE_MID_SIDE ) {
for (i = 0; i < len; i++) {
uint64_t a = decoded[0][i];

Loading…
Cancel
Save