diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/lib/broker/BrokerMessage.cpp | 1 | ||||
-rw-r--r-- | cpp/tests/MessageBuilderTest.cpp | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/cpp/lib/broker/BrokerMessage.cpp b/cpp/lib/broker/BrokerMessage.cpp index 7fa1444a9e..50bf319797 100644 --- a/cpp/lib/broker/BrokerMessage.cpp +++ b/cpp/lib/broker/BrokerMessage.cpp @@ -140,6 +140,7 @@ void Message::decodeContent(Buffer& buffer, u_int32_t chunkSize) u_int64_t expected = expectedContentSize(); if (expected != buffer.available()) { std::cout << "WARN: Expected " << expectedContentSize() << " bytes, got " << buffer.available() << std::endl; + throw Exception("Cannot decode content, buffer not large enough."); } if (!chunkSize || chunkSize > expected) { diff --git a/cpp/tests/MessageBuilderTest.cpp b/cpp/tests/MessageBuilderTest.cpp index d609fb9b75..3f84142461 100644 --- a/cpp/tests/MessageBuilderTest.cpp +++ b/cpp/tests/MessageBuilderTest.cpp @@ -62,9 +62,9 @@ class MessageBuilderTest : public CppUnit::TestCase } } - void appendContent(u_int64_t msgId, const string& data) + void appendContent(Message* msg, const string& data) { - if (msgId == 1) { + if (msg) { content->putRawData(data); } else { throw qpid::Exception("Invalid message id!"); |