Skip to content

Commit

Permalink
CdrSizeCalculator adds 4 bytes extra in a fixed string member of muta…
Browse files Browse the repository at this point in the history
…ble structure in XCDRv2 (#238)

* Refs #21794. Add regression test

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #21794. Fix

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

---------

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
  • Loading branch information
richiware authored Oct 4, 2024
1 parent 101a156 commit 5d445ee
Show file tree
Hide file tree
Showing 3 changed files with 462 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/fastcdr/CdrSizeCalculator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ class CdrSizeCalculator
{
size_t calculated_size {4 + alignment(current_alignment, 4) + data.size() + 1};
current_alignment += calculated_size;
serialized_member_size_ = SERIALIZED_MEMBER_SIZE;

return calculated_size;
}
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/CdrSizeCalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ CdrSizeCalculator::CdrSizeCalculator(
CdrSizeCalculator::CdrSizeCalculator(
CdrVersion cdr_version,
EncodingAlgorithmFlag encoding)
: cdr_version_(cdr_version)
, current_encoding_(encoding)
: CdrSizeCalculator(cdr_version)
{
current_encoding_ = encoding;
}

CdrVersion CdrSizeCalculator::get_cdr_version() const
Expand Down
Loading

0 comments on commit 5d445ee

Please sign in to comment.