mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [10/15] git commit: Fixed protobuf::read bug exposed when running Mesos compiled by clang.
Date Tue, 14 Jan 2014 20:05:01 GMT
Fixed protobuf::read bug exposed when running Mesos compiled by clang.

Review: https://reviews.apache.org/r/16660


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c2bf2459
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c2bf2459
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c2bf2459

Branch: refs/heads/master
Commit: c2bf245940fede312db19d9596a532cb164b0005
Parents: 95eda5a
Author: Benjamin Hindman <benjamin.hindman@gmail.com>
Authored: Sun Dec 29 22:52:37 2013 -0700
Committer: Benjamin Hindman <benjamin.hindman@gmail.com>
Committed: Tue Jan 14 12:00:40 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c2bf2459/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
index 3fa7fe6..abbb537 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
@@ -124,9 +124,13 @@ inline Result<T> read(int fd, bool ignorePartial = false)
   }
 
   // Parse the protobuf from the string.
+  // NOTE: We need to capture a const reference to the data because it
+  // must outlive the creation of ArrayInputStream.
+  const std::string& data = result.get();
+
   T message;
   google::protobuf::io::ArrayInputStream stream(
-      result.get().data(), result.get().size());
+      data.data(), data.size());
 
   if (!message.ParseFromZeroCopyStream(&stream)) {
     // Restore the offset to before the size read.


Mime
View raw message