Skip to content

Commit

Permalink
Capture all fastcdr exceptions (#3540)
Browse files Browse the repository at this point in the history
* Refs #18001. Fixes on DDSFilterExpression.cpp

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #18001. Fixes on TCPControlMessage.cpp

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #18001. Changes in DynamicPubSubType.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #18001. Changes in TypeLookupTypes.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #18001. Changes in AESGCMGMAC_Transform.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs #18001. Uncrustify.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

---------

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
(cherry picked from commit f4000e8)

Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
  • Loading branch information
mergify[bot] and MiguelCompany authored May 30, 2023
1 parent 49deef0 commit 755adc4
Show file tree
Hide file tree
Showing 5 changed files with 658 additions and 567 deletions.
18 changes: 9 additions & 9 deletions src/cpp/dynamic-types/DynamicPubSubType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,16 @@ bool DynamicPubSubType::deserialize(
eprosima::fastcdr::FastBuffer fastbuffer((char*)payload->data, payload->length); // Object that manages the raw buffer.
eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
eprosima::fastcdr::Cdr::DDS_CDR); // Object that deserializes the data.
// Deserialize encapsulation.
deser.read_encapsulation();
payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;

try
{
((DynamicData*)data)->deserialize(deser); //Deserialize the object:
// Deserialize encapsulation.
deser.read_encapsulation();
payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
//Deserialize the object:
((DynamicData*)data)->deserialize(deser);
}
catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/)
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
Expand Down Expand Up @@ -184,14 +185,13 @@ bool DynamicPubSubType::serialize(
eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR);
payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;

// Serialize encapsulation
ser.serialize_encapsulation();

try
{
// Serialize encapsulation
ser.serialize_encapsulation();
((DynamicData*)data)->serialize(ser); // Serialize the object:
}
catch (eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/)
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
{
return false;
}
Expand Down
Loading

0 comments on commit 755adc4

Please sign in to comment.