diff options
author | Timo Teräs <timo.teras@iki.fi> | 2015-11-28 08:27:39 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-12-06 02:51:27 +0100 |
commit | aa9ac199b8c7bf28bcd4d4ff1fc7f68e3fff5123 (patch) | |
tree | 72e6ae7e655fea16db40b974e94eb6b413777d65 | |
parent | f2258e98991c392a23ad089fcbff76f972699103 (diff) | |
download | ffmpeg-aa9ac199b8c7bf28bcd4d4ff1fc7f68e3fff5123.tar.gz |
mpegencts: Fix overflow in cbr mode period calculations
ts->mux_rate is int (signed 32-bit) type. The period calculations
will start to overflow when mux_rate > 5mbps. This fixes overflows
by converting first to 64-bit type.
Fixes #5044.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 64f7db554ee83846f207e82a08946a6a5a6acfe2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/mpegtsenc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 45bab1ce01..9b5864d1ef 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -756,11 +756,11 @@ static int mpegts_write_header(AVFormatContext *s) ts_st = pcr_st->priv_data; if (ts->mux_rate > 1) { - service->pcr_packet_period = (ts->mux_rate * ts->pcr_period) / + service->pcr_packet_period = (int64_t)ts->mux_rate * ts->pcr_period / (TS_PACKET_SIZE * 8 * 1000); - ts->sdt_packet_period = (ts->mux_rate * SDT_RETRANS_TIME) / + ts->sdt_packet_period = (int64_t)ts->mux_rate * SDT_RETRANS_TIME / (TS_PACKET_SIZE * 8 * 1000); - ts->pat_packet_period = (ts->mux_rate * PAT_RETRANS_TIME) / + ts->pat_packet_period = (int64_t)ts->mux_rate * PAT_RETRANS_TIME / (TS_PACKET_SIZE * 8 * 1000); if (ts->copyts < 1) |