You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by cl...@apache.org on 2020/07/13 17:18:49 UTC
[qpid-cpp] branch master updated: QPID-8453: fix boundary test
between map8 and map32 encodings for AMQP 1.0 messages
This is an automated email from the ASF dual-hosted git repository.
cliffjansen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-cpp.git
The following commit(s) were added to refs/heads/master by this push:
new 9be8db5 QPID-8453: fix boundary test between map8 and map32 encodings for AMQP 1.0 messages
9be8db5 is described below
commit 9be8db506b10584872dd14f8fef5cc8c53118f79
Author: Cliff Jansen <cl...@apache.org>
AuthorDate: Mon Jul 13 10:18:14 2020 -0700
QPID-8453: fix boundary test between map8 and map32 encodings for AMQP 1.0 messages
---
src/qpid/amqp/MapEncoder.cpp | 4 +++-
src/qpid/amqp/MapSizeCalculator.cpp | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/qpid/amqp/MapEncoder.cpp b/src/qpid/amqp/MapEncoder.cpp
index cf8ef4e..43e1954 100644
--- a/src/qpid/amqp/MapEncoder.cpp
+++ b/src/qpid/amqp/MapEncoder.cpp
@@ -116,9 +116,11 @@ void MapEncoder::handleString(const CharSequence& key, const CharSequence& value
void MapEncoder::writeMetaData(size_t size, size_t count, const Descriptor* d)
{
- if (count > 255 || size > 255) {
+
+ if (count > 255 || (size+1) > 255) {
writeMap32MetaData((uint32_t) size, (uint32_t) count, d);
} else {
+ /* can use more compact format */
writeMap8MetaData((uint8_t) size, (uint8_t) count, d);
}
}
diff --git a/src/qpid/amqp/MapSizeCalculator.cpp b/src/qpid/amqp/MapSizeCalculator.cpp
index 2da1521..4107df6 100644
--- a/src/qpid/amqp/MapSizeCalculator.cpp
+++ b/src/qpid/amqp/MapSizeCalculator.cpp
@@ -139,7 +139,7 @@ size_t MapSizeCalculator::getTotalSizeRequired(const Descriptor* d) const
size_t result(size);
if (d) result += d->getSize();
result += 1/*typecode*/;
- if (count * 2 > 255 || size > 255) {
+ if (count * 2 > 255 || (size+1) > 255) {
result += 4/*size*/ + 4/*count*/;
} else {
result += 1/*size*/ + 1/*count*/;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org