avcodec/wavarc: Fix integer overflwo in do_stereo()

Fixes: signed integer overflow: 148676193 - -2006512262 cannot be represented in type 'int'
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5963163952349184

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 f3c986200d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
release/6.0
Michael Niedermayer 1 year ago
parent 47333e3e30
commit 0ae86db6ba
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 4
      libavcodec/wavarc.c

@ -141,11 +141,11 @@ static void do_stereo(WavArcContext *s, int ch, int correlated, int len)
} else {
if (correlated) {
for (int n = 0; n < nb_samples; n++)
s->samples[1][n + len] += s->samples[0][n + len];
s->samples[1][n + len] += (unsigned)s->samples[0][n + len];
}
for (int n = 0; n < len; n++) {
s->pred[0][n] = s->samples[1][nb_samples + n];
s->pred[1][n] = s->pred[0][n] - s->samples[0][nb_samples + n];
s->pred[1][n] = s->pred[0][n] - (unsigned)s->samples[0][nb_samples + n];
}
}
}

Loading…
Cancel
Save