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 | 189660fdc736b495fee20d4a83a7d8a3573e4309 (patch) | |
tree | 2975330d4f66776c2d7910a8416372791ba8ee9a | |
parent | aa47eb2e0560ade9e0d899e72d733bb6764973b6 (diff) | |
parent | 6cb3f224d7e2280f8834d361bba1a72682aaaad1 (diff) | |
download | frameworks_av-189660fdc736b495fee20d4a83a7d8a3573e4309.zip frameworks_av-189660fdc736b495fee20d4a83a7d8a3573e4309.tar.gz frameworks_av-189660fdc736b495fee20d4a83a7d8a3573e4309.tar.bz2 |
Merge "Fix overflow of rand in ARTPConnection"
-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 501a970..af369b5 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) { |