From: Artem Karukov Date: Thu, 21 Mar 2019 12:05:53 +0000 (+0000) Subject: FS-11715: sanitize negative value for pkt_lost X-Git-Tag: v1.10.0~17^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=500b4c23b0c4c389195eb59a13b229c640fa2e8c;p=thirdparty%2Ffreeswitch.git FS-11715: sanitize negative value for pkt_lost --- diff --git a/src/switch_rtp.c b/src/switch_rtp.c index c2e7e0f6fb..a7ae604d24 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1838,6 +1838,8 @@ static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_ } pkt_lost = expected_pkt - stats->period_pkt_count; + if (pkt_lost < 0) pkt_lost = 0; + stats->cum_lost=stats->cum_lost+pkt_lost; if (expected_pkt > 0 && pkt_lost > 0) { rtcp_report_block->fraction = (uint8_t) (pkt_lost * 256 / expected_pkt);