[asterisk-commits] mmichelson: branch 1.8 r365298 - /branches/1.8/res/res_rtp_asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 4 10:48:51 CDT 2012


Author: mmichelson
Date: Fri May  4 10:48:44 2012
New Revision: 365298

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=365298
Log:
Fix core FINDING 2, FINDING 3, and FINDING 4 from Coverity's CONSTANT_EXPRESSION_RESULT report.

These three all are in RTP code that attempts to print the number of sequence number cycles
in an RTCP RR report. The code was masking out the upper 16 bits and then shifting the number
right by 16 bits. This led to an all zero result in all cases. The fix is to do the shift without
the bit masking.

(issue ASTERISK-19649)


Modified:
    branches/1.8/res/res_rtp_asterisk.c

Modified: branches/1.8/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/res/res_rtp_asterisk.c?view=diff&rev=365298&r1=365297&r2=365298
==============================================================================
--- branches/1.8/res/res_rtp_asterisk.c (original)
+++ branches/1.8/res/res_rtp_asterisk.c Fri May  4 10:48:44 2012
@@ -1933,7 +1933,7 @@
 				ast_verbose("  Fraction lost: %ld\n", (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24));
 				ast_verbose("  Packets lost so far: %d\n", rtp->rtcp->reported_lost);
 				ast_verbose("  Highest sequence number: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff));
-				ast_verbose("  Sequence number cycles: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff) >> 16);
+				ast_verbose("  Sequence number cycles: %ld\n", (long) (ntohl(rtcpheader[i + 2])) >> 16);
 				ast_verbose("  Interarrival jitter: %u\n", rtp->rtcp->reported_jitter);
 				ast_verbose("  Last SR(our NTP): %lu.%010lu\n",(unsigned long) ntohl(rtcpheader[i + 4]) >> 16,((unsigned long) ntohl(rtcpheader[i + 4]) << 16) * 4096);
 				ast_verbose("  DLSR: %4.4f (sec)\n",ntohl(rtcpheader[i + 5])/65536.0);
@@ -1960,7 +1960,7 @@
 					      (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24),
 					      rtp->rtcp->reported_lost,
 					      (long) (ntohl(rtcpheader[i + 2]) & 0xffff),
-					      (long) (ntohl(rtcpheader[i + 2]) & 0xffff) >> 16,
+					      (long) (ntohl(rtcpheader[i + 2])) >> 16,
 					      rtp->rtcp->reported_jitter,
 					      (unsigned long) ntohl(rtcpheader[i + 4]) >> 16, ((unsigned long) ntohl(rtcpheader[i + 4]) << 16) * 4096,
 					      ntohl(rtcpheader[i + 5])/65536.0,
@@ -1984,7 +1984,7 @@
 					      (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24),
 					      rtp->rtcp->reported_lost,
 					      (long) (ntohl(rtcpheader[i + 2]) & 0xffff),
-					      (long) (ntohl(rtcpheader[i + 2]) & 0xffff) >> 16,
+					      (long) (ntohl(rtcpheader[i + 2])) >> 16,
 					      rtp->rtcp->reported_jitter,
 					      (unsigned long) ntohl(rtcpheader[i + 4]) >> 16,
 					      ((unsigned long) ntohl(rtcpheader[i + 4]) << 16) * 4096,




More information about the asterisk-commits mailing list