Skip to content

Commit

Permalink
Properly initialize CDR stream before using it for filtering (#81)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Sorbini <[email protected]>
  • Loading branch information
asorbini authored Apr 7, 2022
1 parent 81f34f0 commit ca23cc5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rmw_connextdds_common/src/ndds/custom_sql_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,11 @@ RTI_CustomSqlFilter_writer_evaluate(
reinterpret_cast<char *>(
const_cast<uint8_t *>(serialized_sample)),
serialized_size);
if (!RTICdrStream_deserializeCdrEncapsulationAndSetDefault(&cdr_stream)) {
RMW_CONNEXT_LOG_ERROR("failed to deserialize and set CDR encapsulation")
return nullptr;
}
RTICdrStream_resetAlignment(&cdr_stream);
RTICdrStream_setCurrentPositionOffset(
&cdr_stream,
RMW_Connext_MessageTypeSupport::ENCAPSULATION_HEADER_SIZE);
Expand Down Expand Up @@ -709,6 +714,11 @@ RTI_CustomSqlFilter_evaluate(
&cdr_stream,
reinterpret_cast<char *>(msg->data_buffer.buffer),
msg->data_buffer.buffer_length);
if (!RTICdrStream_deserializeCdrEncapsulationAndSetDefault(&cdr_stream)) {
RMW_CONNEXT_LOG_ERROR("failed to deserialize and set CDR encapsulation")
return DDS_BOOLEAN_FALSE;
}
RTICdrStream_resetAlignment(&cdr_stream);
RTICdrStream_setCurrentPositionOffset(
&cdr_stream,
RMW_Connext_MessageTypeSupport::ENCAPSULATION_HEADER_SIZE);
Expand Down

0 comments on commit ca23cc5

Please sign in to comment.