avformat/hlsenc: Fix overflow of int for durations compute

Fix ticket: 8037

Reported-by: DusanBrejka
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
Steven Liu 2019-07-29 19:48:06 +08:00
parent 43891ea8ab
commit 23678462c0

View 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 ;
}