[Cmake-commits] CMake branch, next, updated. v3.0.0-3730-gd7ad00f

Brad King brad.king at kitware.com
Fri Jun 13 15:44:52 EDT 2014


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  d7ad00facd6ed79e4c1d53f30a5d9a6716eed2e4 (commit)
       via  5b2c2d2fda62208d9e65b86e2fa7e4467c431088 (commit)
       via  fe44f057f200619702e42e472b3e18612eaa359f (commit)
      from  f207a13efca9d5ecf8c188651291ff5aa18f77e7 (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=d7ad00facd6ed79e4c1d53f30a5d9a6716eed2e4
commit d7ad00facd6ed79e4c1d53f30a5d9a6716eed2e4
Merge: f207a13 5b2c2d2
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jun 13 15:44:51 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jun 13 15:44:51 2014 -0400

    Merge topic 'fix-read-after-free' into next
    
    5b2c2d2f Merge branch 'backport-fix-read-after-free' into fix-read-after-free
    fe44f057 cmake: Fix read-after-free while checking command-line arguments


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5b2c2d2fda62208d9e65b86e2fa7e4467c431088
commit 5b2c2d2fda62208d9e65b86e2fa7e4467c431088
Merge: 23ffb72 fe44f05
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 12 11:35:10 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 12 11:35:10 2014 -0400

    Merge branch 'backport-fix-read-after-free' into fix-read-after-free
    
    Resolve conflicts in Source/cmake.cxx in our favor.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe44f057f200619702e42e472b3e18612eaa359f
commit fe44f057f200619702e42e472b3e18612eaa359f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 12 09:46:54 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 12 09:52:33 2014 -0400

    cmake: Fix read-after-free while checking command-line arguments
    
    Since commit v2.8.12~300^2~1 (CLI: Suppress the unused warning if the
    key value pair is cached, 2013-05-16), cmake::SetCacheArgs saves a
    cachedValue pointer and may cause the memory to be freed (by setting the
    cache entry) before reading it again.  Fix this by saving the old value
    in a separate string.

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 7cbc1da..fafcca8 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -339,16 +339,24 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
         // The value is transformed if it is a filepath for example, so
         // we can't compare whether the value is already in the cache until
         // after we call AddCacheEntry.
-        const char *cachedValue =
-                              this->CacheManager->GetCacheValue(var.c_str());
+        bool haveValue = false;
+        std::string cachedValue;
+        if(this->WarnUnusedCli)
+          {
+          if(const char *v = this->CacheManager->GetCacheValue(var.c_str()))
+            {
+            haveValue = true;
+            cachedValue = v;
+            }
+          }
 
         this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(),
           "No help, variable specified on the command line.", type);
+
         if(this->WarnUnusedCli)
           {
-          if (!cachedValue
-              || strcmp(this->CacheManager->GetCacheValue(var.c_str()),
-                        cachedValue) != 0)
+          if (!haveValue ||
+              cachedValue != this->CacheManager->GetCacheValue(var.c_str()))
             {
             this->WatchUnusedCli(var.c_str());
             }

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list