avformat: Fix overflow in compute_pkt_fields().
authorDale Curtis <dalecurtis@chromium.org>
Thu, 14 May 2020 21:47:49 +0000 (14:47 -0700)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 5 Jun 2020 22:25:00 +0000 (00:25 +0200)
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/utils.c

index b3d902c..6672493 100644 (file)
@@ -1359,7 +1359,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
             if (st->last_IP_duration == 0 && (uint64_t)pkt->duration <= INT32_MAX)
                 st->last_IP_duration = pkt->duration;
             if (pkt->dts != AV_NOPTS_VALUE)
-                st->cur_dts = pkt->dts + st->last_IP_duration;
+                st->cur_dts = av_sat_add64(pkt->dts, st->last_IP_duration);
             if (pkt->dts != AV_NOPTS_VALUE &&
                 pkt->pts == AV_NOPTS_VALUE &&
                 st->last_IP_duration > 0 &&