Skip to content

Commit

Permalink
Fix mutable size-three optional serialization
Browse files Browse the repository at this point in the history
Signed-off-by: Jesus Perez <jesusperez@eprosima.com>
  • Loading branch information
jepemi committed Dec 12, 2024
1 parent 0cb11a4 commit ceced5a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/fastcdr/CdrSizeCalculator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,12 +1245,14 @@ class CdrSizeCalculator
if (CdrVersion::XCDRv2 == cdr_version_ && EncodingAlgorithmFlag::PL_CDR2 == current_encoding_ &&
0 < calculated_size)
{
if (8 < calculated_size)
if (8 < calculated_size ||
(1 != calculated_size && 2 != calculated_size && 4 != calculated_size &&
8 != calculated_size))
{
extra_size = 8; // Long EMHEADER.
if (NO_SERIALIZED_MEMBER_SIZE != serialized_member_size_)
{
extra_size -= 4; // Join NEXTINT and DHEADER.
calculated_size -= 4; // Join NEXTINT and DHEADER.
}
}
else
Expand Down

0 comments on commit ceced5a

Please sign in to comment.