diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2024-05-12 00:13:58 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2024-05-19 22:14:38 +0200 |
commit | b6b2b01025e016ce29e5add57305384a663edcfc (patch) | |
tree | 77103dc14e114ec6238474a28f33c2f81ed10d35 /libavcodec | |
parent | 8fc649b931a3cbc3a2dd9b50b75a9261a2fb4b49 (diff) | |
download | ffmpeg-b6b2b01025e016ce29e5add57305384a663edcfc.tar.gz |
avcodec/mpegvideo_enc: Fix potential overflow in RD
Fixes: CID1500285 Unintentional integer overflow
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index b601a1a9e4..73a9082265 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1433,7 +1433,7 @@ static int estimate_best_b_count(MpegEncContext *s) goto fail; } - rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); + rd += (out_size * (uint64_t)lambda2) >> (FF_LAMBDA_SHIFT - 3); } /* get the delayed frames */ @@ -1442,7 +1442,7 @@ static int estimate_best_b_count(MpegEncContext *s) ret = out_size; goto fail; } - rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); + rd += (out_size * (uint64_t)lambda2) >> (FF_LAMBDA_SHIFT - 3); rd += c->error[0] + c->error[1] + c->error[2]; |