From afbcc2106e404231bc0cfedb615b7674e2ae8c9c Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Wed, 12 Jul 2023 11:54:20 +0200 Subject: [PATCH] Fix double call to `size()` in `serializeMsgPack()` --- CHANGELOG.md | 1 + src/ArduinoJson/MsgPack/MsgPackSerializer.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2eaa4dd..cd09639e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ HEAD * Fix compatibility with the Blynk libary (issue #1914) * Fix double lookup in `to()` +* Fix double call to `size()` in `serializeMsgPack()` v6.21.2 (2023-04-12) ------- diff --git a/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp b/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp index 65769a16..6125330c 100644 --- a/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp +++ b/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp @@ -47,7 +47,7 @@ class MsgPackSerializer : public Visitor { size_t visitArray(const CollectionData& array) { size_t n = array.size(); if (n < 0x10) { - writeByte(uint8_t(0x90 + array.size())); + writeByte(uint8_t(0x90 + n)); } else if (n < 0x10000) { writeByte(0xDC); writeInteger(uint16_t(n));