avformat/hlsenc: Fix overflow of int for durations compute
authorSteven Liu <lq@chinaffmpeg.org>
Mon, 29 Jul 2019 11:48:06 +0000 (19:48 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Mon, 29 Jul 2019 11:48:06 +0000 (19:48 +0800)
Fix ticket: 8037

Reported-by: DusanBrejka
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
libavformat/hlsenc.c

index 2ade672..51310fb 100644 (file)
@@ -2301,8 +2301,8 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
 
     if (vs->sequence - vs->nb_entries > hls->start_sequence && hls->init_time > 0) {
         /* reset end_pts, hls->recording_time at end of the init hls list */
-        int init_list_dur = hls->init_time * vs->nb_entries * AV_TIME_BASE;
-        int after_init_list_dur = (vs->sequence - hls->start_sequence - vs->nb_entries ) * (hls->time * AV_TIME_BASE);
+        int64_t init_list_dur = hls->init_time * vs->nb_entries * AV_TIME_BASE;
+        int64_t after_init_list_dur = (vs->sequence - hls->start_sequence - vs->nb_entries ) * (hls->time * AV_TIME_BASE);
         hls->recording_time = hls->time * AV_TIME_BASE;
         end_pts = init_list_dur + after_init_list_dur ;
     }