diff options
author | Andreas Huber <andih@google.com> | 2013-04-24 15:49:25 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2013-04-24 15:49:25 +0000 |
commit | 0dbff625c3128962b48f3476ceacb3ac80a3f421 (patch) | |
tree | d0093457fd5b7279c7eae9e18e41f5b7f55d8b07 | |
parent | 628a8c0ed91531468f5c615fea8745f63cc812aa (diff) | |
parent | be21e039d7d993872ac85a0279ea657e40f674fd (diff) |
Merge "Fix overflow of rand in ARTPConnection"tools_r22
-rw-r--r-- | media/libstagefright/rtsp/ARTPConnection.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/media/libstagefright/rtsp/ARTPConnection.cpp b/media/libstagefright/rtsp/ARTPConnection.cpp index 501a970b..af369b56 100644 --- a/media/libstagefright/rtsp/ARTPConnection.cpp +++ b/media/libstagefright/rtsp/ARTPConnection.cpp @@ -117,7 +117,8 @@ void ARTPConnection::MakePortPair( bumpSocketBufferSize(*rtcpSocket); - unsigned start = (rand() * 1000)/ RAND_MAX + 15550; + /* rand() * 1000 may overflow int type, use long long */ + unsigned start = (unsigned)((rand()* 1000ll)/RAND_MAX) + 15550; start &= ~1; for (unsigned port = start; port < 65536; port += 2) { |