From 4b4febb3ea1291c6ae515211bd9b5b3f7b549c33 Mon Sep 17 00:00:00 2001 From: Christian Seiler Date: Sat, 30 May 2026 13:04:36 +0200 Subject: [PATCH] C++: fix parser bug in structured logic The bug was already fixed in the parseonly code, but not in the generic structured code. --- cpp/src/monoformat_structured.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpp/src/monoformat_structured.cpp b/cpp/src/monoformat_structured.cpp index 185952a..ac29a06 100644 --- a/cpp/src/monoformat_structured.cpp +++ b/cpp/src/monoformat_structured.cpp @@ -1513,6 +1513,9 @@ std::expected, ParseError> ClippedTextElemen return std::unexpected(textLength.error()); } std::size_t alignedRoundedUp = (*textLength + 2 + 4 - 1) / 4 * 4 - 2; + if (formatVersion >= 2) { + alignedRoundedUp = (*textLength + 4 - 1) / 4 * 4; + } auto textData = readBuffer(buffer, alignedRoundedUp); if (!textData) { return std::unexpected(textData.error());