diff options
author | Stephen D. Huston <shuston@apache.org> | 2008-12-23 18:21:04 +0000 |
---|---|---|
committer | Stephen D. Huston <shuston@apache.org> | 2008-12-23 18:21:04 +0000 |
commit | 1ac4193fbf6dcbf1e95da4250b6d3bb1d928ab2f (patch) | |
tree | 9c0390b8c2c20165aa9e4c37bce5cd75a3672743 | |
parent | 68c51a39f86f5b6664e5230f8d25ff072aef9ecf (diff) | |
download | qpid-python-1ac4193fbf6dcbf1e95da4250b6d3bb1d928ab2f.tar.gz |
Fix encoding 0-length values; resolves QPID-1449
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@729054 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/framing/FieldValue.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/framing/FieldValue.h b/qpid/cpp/src/qpid/framing/FieldValue.h index 8a2d9e49e3..29760619e5 100644 --- a/qpid/cpp/src/qpid/framing/FieldValue.h +++ b/qpid/cpp/src/qpid/framing/FieldValue.h @@ -193,12 +193,14 @@ class VariableWidthValue : public FieldValue::Data { uint32_t encodedSize() const { return lenwidth + octets.size(); } void encode(Buffer& buffer) { buffer.putUInt<lenwidth>(octets.size()); - buffer.putRawData(&octets[0], octets.size()); + if (octets.size() > 0) + buffer.putRawData(&octets[0], octets.size()); }; void decode(Buffer& buffer) { uint32_t len = buffer.getUInt<lenwidth>(); octets.resize(len); - buffer.getRawData(&octets[0], len); + if (len > 0) + buffer.getRawData(&octets[0], len); } bool operator==(const Data& d) const { const VariableWidthValue<lenwidth>* rhs = dynamic_cast< const VariableWidthValue<lenwidth>* >(&d); |