mirror of
https://github.com/librempeg/librempeg
synced 2024-11-22 09:02:20 +00:00
avcodec/mpeg12enc: Use av_rescale() in vbv_buffer_size computation
Fixes: signed integer overflow: 20 * 2314885530818453759 cannot be represented in type 'long' Fixes: 69098/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG2VIDEO_fuzzer-6107989688778752 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
8ba208e321
commit
c568b99673
@ -330,7 +330,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
|
||||
else
|
||||
/* VBV calculation: Scaled so that a VCD has the proper
|
||||
* VBV size of 40 kilobytes */
|
||||
vbv_buffer_size = ((20 * s->bit_rate) / (1151929 / 2)) * 8 * 1024;
|
||||
vbv_buffer_size = av_rescale_rnd(s->bit_rate, 20, 1151929 / 2, AV_ROUND_ZERO) * 8 * 1024;
|
||||
vbv_buffer_size = (vbv_buffer_size + 16383) / 16384;
|
||||
|
||||
put_sbits(&s->pb, 18, v);
|
||||
|
Loading…
Reference in New Issue
Block a user