You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by da...@apache.org on 2016/04/20 02:37:47 UTC

[2/3] incubator-kudu git commit: Fix use after free in RowSetTree

Fix use after free in RowSetTree

This fixes a use after free bug which only causes issues on OS X. libstdcxx's
ref-counted strings on libstdc++ hide the bug by not destructing the stack
allocated string, because it had been copied elsewhere in the meantime.

Change-Id: Id640ec1f1092a28cbba00becebb8ff2e81828b77
Reviewed-on: http://gerrit.cloudera.org:8080/2816
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/75d5c826
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/75d5c826
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/75d5c826

Branch: refs/heads/master
Commit: 75d5c82642334e44cdced1ac77a2927b57c8cfa4
Parents: 06f94fb
Author: Dan Burkert <da...@cloudera.com>
Authored: Tue Apr 19 14:11:27 2016 -0700
Committer: Dan Burkert <da...@cloudera.com>
Committed: Tue Apr 19 21:43:31 2016 +0000

----------------------------------------------------------------------
 src/kudu/tablet/rowset_tree.cc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/75d5c826/src/kudu/tablet/rowset_tree.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/rowset_tree.cc b/src/kudu/tablet/rowset_tree.cc
index 15fbd23..417a12f 100644
--- a/src/kudu/tablet/rowset_tree.cc
+++ b/src/kudu/tablet/rowset_tree.cc
@@ -111,13 +111,15 @@ Status RowSetTree::Reset(const RowSetVector &rowsets) {
     }
     DCHECK_LE(min_key.compare(max_key), 0)
       << "Rowset min must be <= max: " << rs->ToString();
-    // Load into key endpoints.
-    endpoints.push_back(RSEndpoint(rsit->rowset, START, min_key));
-    endpoints.push_back(RSEndpoint(rsit->rowset, STOP, max_key));
 
     // Load bounds and save entry
-    rsit->min_key = min_key;
-    rsit->max_key = max_key;
+    rsit->min_key = std::move(min_key);
+    rsit->max_key = std::move(max_key);
+
+    // Load into key endpoints.
+    endpoints.push_back(RSEndpoint(rsit->rowset, START, rsit->min_key));
+    endpoints.push_back(RSEndpoint(rsit->rowset, STOP, rsit->max_key));
+
     entries.push_back(rsit.release());
   }