TT#14008 fix integer handling (overflow/sign) issues

Warned-by: coverity

Change-Id: Ia473075046253b2ffcf65344f65469772e6df993
rfuchs/1283
Richard Fuchs 5 years ago
parent 2e66655925
commit b734fc080e

@ -55,7 +55,7 @@ static void dtmf_bencode_and_notify(struct media_packet *mp,
bencode_dictionary_add_string(data, "source_ip", sockaddr_print_buf(&mp->fsin.address));
bencode_dictionary_add_integer(data, "timestamp", rtpe_now.tv_sec);
bencode_dictionary_add_integer(data, "event", dtmf->event);
bencode_dictionary_add_integer(data, "duration", (ntohs(dtmf->duration) * (1000000 / clockrate)) / 1000);
bencode_dictionary_add_integer(data, "duration", ((long long) ntohs(dtmf->duration) * (1000000LL / clockrate)) / 1000LL);
bencode_dictionary_add_integer(data, "volume", dtmf->volume);
bencode_collapse_str(notify, &encoded_data);
@ -357,7 +357,7 @@ const char *dtmf_inject(struct call_media *media, int code, int volume, int dura
ssrc_in->parent->h.ssrc);
// synthesise start and stop events
uint64_t num_samples = duration * ch->dest_pt.clock_rate / 1000;
uint64_t num_samples = (uint64_t) duration * ch->dest_pt.clock_rate / 1000;
uint64_t start_pts = codec_encoder_pts(csh);
uint64_t last_end_pts = codec_last_dtmf_event(csh);
if (last_end_pts) {

@ -2020,7 +2020,7 @@ static int amr_decoder_input(decoder_t *dec, const str *data, GQueue *out) {
if (!dec->u.avc.u.amr.last_cmr.tv_sec) // start tracking now
dec->u.avc.u.amr.last_cmr = rtpe_now;
else if (timeval_diff(&rtpe_now, &dec->u.avc.u.amr.last_cmr)
>= dec->codec_options.amr.mode_change_interval * 1000) {
>= (long long) dec->codec_options.amr.mode_change_interval * 1000) {
// switch up if we can
decoder_event(dec, CE_AMR_CMR_RECV, GUINT_TO_POINTER(0xffff));
dec->u.avc.u.amr.last_cmr = rtpe_now;

Loading…
Cancel
Save