avcodec/vc2enc: basic sanity check on slice_max_bytes

Fixes: left shift of 896021632 by 3 places cannot be represented in type 'int'
Fixes: 70544/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC2_fuzzer-6685593652756480

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 2024-09-12 20:03:55 +02:00
parent 665bf46ac2
commit 6df9a0292c
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 1 additions and 1 deletions

View File

@ -988,7 +988,7 @@ static av_cold int vc2_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
s->slice_min_bytes = s->slice_max_bytes - s->slice_max_bytes*(s->tolerance/100.0f);
if (s->slice_min_bytes < 0)
if (s->slice_min_bytes < 0 || s->slice_max_bytes > INT_MAX >> 3)
return AVERROR(EINVAL);
ret = encode_frame(s, avpkt, frame, aux_data, header_size, s->interlaced);