Clamp the calculation of sb64_target_rate to INT_MAX Same fix as in libvpx-vp9: https://chromium-review.googlesource.com/c/webm/libvpx/+/5820131 Bug: b/361617762 Change-Id: I34f7bfca5b7e813092c7374ebbcbc85e34302328
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c index dc882f3..007812d 100644 --- a/av1/encoder/ratectrl.c +++ b/av1/encoder/ratectrl.c
@@ -2292,8 +2292,9 @@ } // Target rate per SB64 (including partial SB64s. - rc->sb64_target_rate = - (int)(((int64_t)rc->this_frame_target << 12) / (width * height)); + const int64_t sb64_target_rate = + ((int64_t)rc->this_frame_target << 12) / (width * height); + rc->sb64_target_rate = (int)AOMMIN(sb64_target_rate, INT_MAX); } static void update_alt_ref_frame_stats(AV1_COMP *cpi) {