Skip to content

Commit 9be8db5

Browse files
author
Cliff Jansen
committed
QPID-8453: fix boundary test between map8 and map32 encodings for AMQP 1.0 messages
1 parent c17d978 commit 9be8db5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/qpid/amqp/MapEncoder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ void MapEncoder::handleString(const CharSequence& key, const CharSequence& value
116116

117117
void MapEncoder::writeMetaData(size_t size, size_t count, const Descriptor* d)
118118
{
119-
if (count > 255 || size > 255) {
119+
120+
if (count > 255 || (size+1) > 255) {
120121
writeMap32MetaData((uint32_t) size, (uint32_t) count, d);
121122
} else {
123+
/* can use more compact format */
122124
writeMap8MetaData((uint8_t) size, (uint8_t) count, d);
123125
}
124126
}

src/qpid/amqp/MapSizeCalculator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ size_t MapSizeCalculator::getTotalSizeRequired(const Descriptor* d) const
139139
size_t result(size);
140140
if (d) result += d->getSize();
141141
result += 1/*typecode*/;
142-
if (count * 2 > 255 || size > 255) {
142+
if (count * 2 > 255 || (size+1) > 255) {
143143
result += 4/*size*/ + 4/*count*/;
144144
} else {
145145
result += 1/*size*/ + 1/*count*/;

0 commit comments

Comments
 (0)