]> granicus.if.org Git - libvpx/commitdiff
Cap duration to avoid overflow
authorJerome Jiang <jianj@google.com>
Mon, 20 Sep 2021 20:37:43 +0000 (13:37 -0700)
committerJerome Jiang <jianj@google.com>
Tue, 21 Sep 2021 17:11:51 +0000 (10:11 -0700)
Bug: webm:1728
Change-Id: Id13475660fa921e8ddcc89847e978da4c8d85886

vp8/encoder/onyx_if.c

index fc154afd146b12c26729b8cc782e758f054840ae..cdcb0a09f775f1ccb7a1dea2babb11a0c1c791e8 100644 (file)
@@ -4921,6 +4921,8 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags,
 
       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));