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>
This commit is contained in:
Michael Niedermayer 2023-08-07 00:19:09 +02:00
parent 0ce322a51e
commit 1a81a40de2
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 12 additions and 0 deletions

View File

@ -218,6 +218,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) {
@ -314,6 +318,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) {
@ -586,6 +594,10 @@ static int decode_5elp(AVCodecContext *avctx,
continue;
case 10:
s->shift = get_urice(gb, 2);
if ((unsigned)s->shift > 31) {
s->shift = 0;
return AVERROR_INVALIDDATA;
}
continue;
case 9:
if (avctx->sample_fmt == AV_SAMPLE_FMT_U8P) {