From edd6a852ef6d04821e034af27e6c5ddc0e92bbfd Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Wed, 18 Apr 2012 14:10:26 +0000 Subject: QPID-3958: Prevent malformed frameset being set when replicating a message with an empty content frame git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1327515 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/framing/FrameSet.cpp | 4 ++++ qpid/cpp/src/qpid/framing/FrameSet.h | 1 + qpid/cpp/src/qpid/replication/ReplicatingEventListener.cpp | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/qpid/cpp/src/qpid/framing/FrameSet.cpp b/qpid/cpp/src/qpid/framing/FrameSet.cpp index d2612e484f..9aee7b98b9 100644 --- a/qpid/cpp/src/qpid/framing/FrameSet.cpp +++ b/qpid/cpp/src/qpid/framing/FrameSet.cpp @@ -102,3 +102,7 @@ std::string FrameSet::getContent() const { getContent(out); return out; } + +bool FrameSet::hasContent() const { + return parts.size() >= 3; +} diff --git a/qpid/cpp/src/qpid/framing/FrameSet.h b/qpid/cpp/src/qpid/framing/FrameSet.h index cae75e5ec8..f11bdb938b 100644 --- a/qpid/cpp/src/qpid/framing/FrameSet.h +++ b/qpid/cpp/src/qpid/framing/FrameSet.h @@ -54,6 +54,7 @@ public: QPID_COMMON_EXTERN void getContent(std::string&) const; QPID_COMMON_EXTERN std::string getContent() const; + bool hasContent() const; bool isContentBearing() const; diff --git a/qpid/cpp/src/qpid/replication/ReplicatingEventListener.cpp b/qpid/cpp/src/qpid/replication/ReplicatingEventListener.cpp index 3d84a1ce3c..9284bda388 100644 --- a/qpid/cpp/src/qpid/replication/ReplicatingEventListener.cpp +++ b/qpid/cpp/src/qpid/replication/ReplicatingEventListener.cpp @@ -131,7 +131,7 @@ boost::intrusive_ptr ReplicatingEventListener::cloneMessage(Queue& queu //cloned body: AMQFrame header(*original->getFrames().getHeaders()); header.setBof(false); - header.setEof(!original->getFrames().getContentSize());//if there is any content then the header is not the end of the frameset + header.setEof(!original->getFrames().hasContent());//if there are any content frames then the header is not the end of the frameset header.setBos(true); header.setEos(true); handler.handle(header); -- cgit v1.2.1