1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

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>
This commit is contained in:
Michael Niedermayer 2024-05-12 00:13:58 +02:00
parent 8fc649b931
commit b6b2b01025
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -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];