[FFmpeg-devel] [PATCH 2/2] avformat/utils: Fix long overflow in compute_pkt_fields()
Michael Niedermayer
michael at niedermayer.cc
Fri Oct 12 04:40:21 EEST 2018
From: Thomas Guilbert <tguilbert at chromium.org>
If ever we have a negative last_IP_duration, we can end up with a long
overflow. This makes sure we use pkt->duration instead of
last_IP_duration if last_IP_duration is negative.
Fixes: compute_pkt_usan
---
libavformat/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index fa3699daef..2c965a7fb2 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1352,7 +1352,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
/* This is tricky: the dts must be incremented by the duration
* of the frame we are displaying, i.e. the last I- or P-frame. */
- if (st->last_IP_duration == 0)
+ if (st->last_IP_duration <= 0)
st->last_IP_duration = pkt->duration;
if (pkt->dts != AV_NOPTS_VALUE)
st->cur_dts = pkt->dts + st->last_IP_duration;
--
2.19.1
More information about the ffmpeg-devel
mailing list