Bug 1020379 - [RTSP] Fix potential infinite loop in ARTPConnection.cpp. r=sworkman
authorEthan Tseng <ettseng@mozilla.com>
Fri, 06 Jun 2014 10:59:47 +0800
changeset 206485 cea5bf661931f3abd532bc1df0d5796463a8ab1f
parent 206484 4720480c606b81fdfeafd27d371e8e469753481f
child 206486 722c6e0845eb77ca18bf5b686eb5609e8efcb17d
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssworkman
bugs1020379
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1020379 - [RTSP] Fix potential infinite loop in ARTPConnection.cpp. r=sworkman
netwerk/protocol/rtsp/rtsp/ARTPConnection.cpp
--- a/netwerk/protocol/rtsp/rtsp/ARTPConnection.cpp
+++ b/netwerk/protocol/rtsp/rtsp/ARTPConnection.cpp
@@ -140,17 +140,17 @@ void ARTPConnection::MakePortPair(
     NetworkActivityMonitor::AttachIOLayer(*rtcpSocket);
 
     // Reduce the chance of using duplicate port numbers.
     srand(time(NULL));
     // rand() * 1000 may overflow int type, use long long.
     unsigned start = (unsigned)((rand() * 1000ll) / RAND_MAX) + 15550;
     start &= ~1;
 
-    for (uint16_t port = start; port < 65536; port += 2) {
+    for (uint32_t port = start; port < 65536; port += 2) {
         PRNetAddr addr;
         addr.inet.family = PR_AF_INET;
         addr.inet.ip = PR_htonl(PR_INADDR_ANY);
         addr.inet.port = PR_htons(port);
 
         if (PR_Bind(*rtpSocket, &addr) == PR_FAILURE) {
             continue;
         }