You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2008/05/01 17:28:12 UTC
svn commit: r652558 - in /incubator/qpid/trunk/qpid/cpp/src/qpid/framing:
AMQFrame.cpp FieldTable.cpp
Author: gsim
Date: Thu May 1 08:28:12 2008
New Revision: 652558
URL: http://svn.apache.org/viewvc?rev=652558&view=rev
Log:
QPID-989: fix decode of zero sized map
Modified:
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQFrame.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.cpp
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQFrame.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQFrame.cpp?rev=652558&r1=652557&r2=652558&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQFrame.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/AMQFrame.cpp Thu May 1 08:28:12 2008
@@ -78,7 +78,7 @@
uint8_t type = buffer.getOctet();
uint16_t frame_size = buffer.getShort();
if (frame_size < frameOverhead())
- throw FramingErrorException(QPID_MSG("Frame size too small"));
+ throw FramingErrorException(QPID_MSG("Frame size too small " << frame_size));
uint8_t reserved1 = buffer.getOctet();
uint8_t field1 = buffer.getOctet();
subchannel = field1 & 0x0f;
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.cpp?rev=652558&r1=652557&r2=652558&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.cpp Thu May 1 08:28:12 2008
@@ -132,19 +132,21 @@
void FieldTable::decode(Buffer& buffer){
uint32_t len = buffer.getLong();
- uint32_t available = buffer.available();
- uint32_t count = buffer.getLong();
- if (available < len)
- throw IllegalArgumentException(QPID_MSG("Not enough data for field table."));
- uint32_t leftover = available - len;
- while(buffer.available() > leftover && count--){
- std::string name;
- ValuePtr value(new FieldValue);
-
- buffer.getShortString(name);
- value->decode(buffer);
- values[name] = ValuePtr(value);
- }
+ if (len) {
+ uint32_t available = buffer.available();
+ if (available < len)
+ throw IllegalArgumentException(QPID_MSG("Not enough data for field table."));
+ uint32_t count = buffer.getLong();
+ uint32_t leftover = available - len;
+ while(buffer.available() > leftover && count--){
+ std::string name;
+ ValuePtr value(new FieldValue);
+
+ buffer.getShortString(name);
+ value->decode(buffer);
+ values[name] = ValuePtr(value);
+ }
+ }
}