This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  6248f5525545334114f2eed43499a415e40977c8 (commit)
       via  63ee771e798fab869db984914c928efb8d5e5c8f (commit)
      from  927204b4dad683d7587efb0a855762aa17b3a833 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6248f5525545334114f2eed43499a415e40977c8
commit 6248f5525545334114f2eed43499a415e40977c8
Merge: 927204b 63ee771
Author:     Rolf Eike Beer <e...@sf-mail.de>
AuthorDate: Mon Dec 22 16:06:31 2014 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Mon Dec 22 16:06:31 2014 -0500

    Merge topic 'base64-casts' into next
    
    63ee771e cmCTest: fix integer overflow when uploading huge files


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=63ee771e798fab869db984914c928efb8d5e5c8f
commit 63ee771e798fab869db984914c928efb8d5e5c8f
Author:     Rolf Eike Beer <e...@sf-mail.de>
AuthorDate: Mon Dec 22 21:56:14 2014 +0100
Commit:     Rolf Eike Beer <e...@sf-mail.de>
CommitDate: Mon Dec 22 21:56:14 2014 +0100

    cmCTest: fix integer overflow when uploading huge files
    
    When uploading files greater 2GB with a 32 bit long the variable will
    overflow, leading to a bad alloc when passed to new. Also avoid floating 
point
    arithmetic when integer calculations will work as well.
    
    Reported-by: Justin Borodinsky <justin.borodin...@gmail.com>

diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 2bf7b77..1a7bf45 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1688,7 +1688,7 @@ std::string cmCTest::Base64GzipEncodeFile(std::string 
file)
 //----------------------------------------------------------------------
 std::string cmCTest::Base64EncodeFile(std::string file)
 {
-  long len = cmSystemTools::FileLength(file);
+  const size_t len = cmSystemTools::FileLength(file);
   cmsys::ifstream ifs(file.c_str(), std::ios::in
 #ifdef _WIN32
     | std::ios::binary
@@ -1699,8 +1699,7 @@ std::string cmCTest::Base64EncodeFile(std::string file)
   ifs.close();
 
   unsigned char *encoded_buffer
-    = new unsigned char [ static_cast<int>(
-        static_cast<double>(len) * 1.5 + 5.0) ];
+    = new unsigned char [ (len * 3) / 2 + 5 ];
 
   unsigned long rlen
     = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1);

-----------------------------------------------------------------------

Summary of changes:
 Source/cmCTest.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to