avcodec/wavarc: Check shift

Fixes: shift exponent 1285 is too large for 32-bit type 'int'
Fixes: 60870/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-5332050340347904

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 1a81a40de2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
release/6.0
Michael Niedermayer 2 years ago
parent ab1981b445
commit d57b29ff2b
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 8
      libavcodec/wavarc.c

@ -205,6 +205,10 @@ static int decode_1dif(AVCodecContext *avctx,
continue;
case 6:
s->shift = get_urice(gb, 2);
if ((unsigned)s->shift > 31) {
s->shift = 0;
return AVERROR_INVALIDDATA;
}
continue;
case 5:
if (avctx->sample_fmt == AV_SAMPLE_FMT_U8P) {
@ -301,6 +305,10 @@ static int decode_2slp(AVCodecContext *avctx,
continue;
case 7:
s->shift = get_urice(gb, 2);
if ((unsigned)s->shift > 31) {
s->shift = 0;
return AVERROR_INVALIDDATA;
}
continue;
case 6:
if (avctx->sample_fmt == AV_SAMPLE_FMT_U8P) {

Loading…
Cancel
Save