]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11715: sanitize negative value for pkt_lost
authorArtem Karukov <akarukov@intermedia.net>
Thu, 21 Mar 2019 12:05:53 +0000 (12:05 +0000)
committerDragos Oancea <dragos@signalwire.com>
Thu, 25 Jul 2019 22:38:57 +0000 (22:38 +0000)
src/switch_rtp.c

index c2e7e0f6fbabe0eb582baef7bbb28c2cbb40ed68..a7ae604d2457e88aab4f23bd43c0370eac26c1e7 100644 (file)
@@ -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);