ref: b247f6e8e442979ea885b5a64bebf44d5a0e4323
parent: 7366195e5a7098de0b7c131f40dd5238b9065a56
parent: 09775194ffdb84b4979f3988e7ef301575b661df
author: Jerome Jiang <jianj@google.com>
date: Wed Sep 22 13:27:26 EDT 2021
Merge "Cap duration to avoid overflow" into main
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -4921,6 +4921,8 @@
this_duration = cpi->source->ts_end - cpi->last_end_time_stamp_seen;
last_duration = cpi->last_end_time_stamp_seen - cpi->last_time_stamp_seen;
+ // Cap this to avoid overflow of (this_duration - last_duration) * 10
+ this_duration = VPXMIN(this_duration, INT64_MAX / 10);
/* do a step update if the duration changes by 10% */
if (last_duration) {
step = (int)(((this_duration - last_duration) * 10 / last_duration));