TT#14008 fix possible unintentional integer overflow

Change-Id: I9dacb34cf92d461029bfb393a251736676431fc7
Warned-by: coverity
pull/1439/head
Richard Fuchs 4 years ago
parent 4be6ff2b07
commit 60fe7104e7

@ -2774,7 +2774,7 @@ static bool __dtx_drift_shift(struct dtx_buffer *dtxb, struct dtx_packet *dtxp,
struct dtx_packet *dtxp_last = g_queue_peek_tail(&dtxb->packets);
ts_diff = dtxp_last->packet->ts - ts;
long long ts_diff_us = (long long) ts_diff * 1000000 / dtxb->clockrate;
if (ts_diff_us >= rtpe_config.dtx_lag * 1000) {
if (ts_diff_us >= (long long) rtpe_config.dtx_lag * 1000) {
// overflow
ilogs(dtx, LOG_DEBUG, "DTX timer queue overflowing (%i packets in queue, "
"%lli ms delay), speeding up DTX timer by %i ms",
@ -2810,7 +2810,7 @@ static bool __dtx_drift_drop(struct dtx_buffer *dtxb, struct dtx_packet *dtxp, u
struct dtx_packet *dtxp_last = g_queue_peek_tail(&dtxb->packets);
ts_diff = dtxp_last->packet->ts - ts;
long long ts_diff_us = (long long) ts_diff * 1000000 / dtxb->clockrate;
if (ts_diff_us >= rtpe_config.dtx_lag * 1000) {
if (ts_diff_us >= (long long) rtpe_config.dtx_lag * 1000) {
// overflow
ilogs(dtx, LOG_DEBUG, "DTX timer queue overflowing (%i packets in queue, "
"%lli ms delay), discarding packet",

@ -210,7 +210,7 @@ static void dtmf_check_trigger(struct call_media *media, char event, uint64_t ts
struct dtmf_event *last_ev = g_queue_peek_tail(&media->dtmf_recv);
if (last_ev) {
uint32_t ts_diff = ts - last_ev->ts;
uint64_t ts_diff_ms = ts_diff * 1000 / clockrate;
uint64_t ts_diff_ms = (uint64_t) ts_diff * 1000 / clockrate;
if (ts_diff_ms > rtpe_config.dtmf_digit_delay) {
// delay too long: restart event trigger
ml->dtmf_trigger_match = 0;

Loading…
Cancel
Save