You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/01/14 21:05:01 UTC
[10/15] git commit: Fixed protobuf::read bug exposed when running
Mesos compiled by clang.
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 <be...@gmail.com>
Authored: Sun Dec 29 22:52:37 2013 -0700
Committer: Benjamin Hindman <be...@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.