Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21638] Be less strict with parameter lengths (backport #5225) #5248

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/cpp/fastdds/core/policy/ParameterSerializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ inline bool ParameterSerializer<ParameterLocator_t>::read_content_from_cdr_messa
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_LOCATOR_LENGTH)
if (parameter_length < PARAMETER_LOCATOR_LENGTH)
{
return false;
}
Expand All @@ -273,7 +273,7 @@ inline bool ParameterSerializer<ParameterKey_t>::read_content_from_cdr_message(
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_KEY_HASH_LENGTH)
if (parameter_length < PARAMETER_KEY_HASH_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -343,7 +343,7 @@ inline bool ParameterSerializer<ParameterPort_t>::read_content_from_cdr_message(
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_PORT_LENGTH)
if (parameter_length < PARAMETER_PORT_LENGTH)
{
return false;
}
Expand All @@ -367,7 +367,7 @@ inline bool ParameterSerializer<ParameterGuid_t>::read_content_from_cdr_message(
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_GUID_LENGTH)
if (parameter_length < PARAMETER_GUID_LENGTH)
{
return false;
}
Expand All @@ -394,7 +394,7 @@ inline bool ParameterSerializer<ParameterProtocolVersion_t>::read_content_from_c
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_PROTOCOL_LENGTH)
if (parameter_length < PARAMETER_PROTOCOL_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -422,7 +422,7 @@ inline bool ParameterSerializer<ParameterVendorId_t>::read_content_from_cdr_mess
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_VENDOR_LENGTH)
if (parameter_length < PARAMETER_VENDOR_LENGTH)
{
return false;
}
Expand All @@ -447,7 +447,7 @@ inline bool ParameterSerializer<ParameterIP4Address_t>::read_content_from_cdr_me
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_IP4_LENGTH)
if (parameter_length < PARAMETER_IP4_LENGTH)
{
return false;
}
Expand All @@ -473,7 +473,7 @@ inline bool ParameterSerializer<ParameterBool_t>::read_content_from_cdr_message(
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_BOOL_LENGTH)
if (parameter_length < PARAMETER_BOOL_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -501,7 +501,7 @@ inline bool ParameterSerializer<ParameterStatusInfo_t>::read_content_from_cdr_me
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_STATUS_INFO_LENGTH)
if (parameter_length < PARAMETER_STATUS_INFO_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -530,7 +530,7 @@ inline bool ParameterSerializer<ParameterCount_t>::read_content_from_cdr_message
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_COUNT_LENGTH)
if (parameter_length < PARAMETER_COUNT_LENGTH)
{
return false;
}
Expand All @@ -552,7 +552,7 @@ inline bool ParameterSerializer<ParameterEntityId_t>::read_content_from_cdr_mess
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_ENTITYID_LENGTH)
if (parameter_length < PARAMETER_ENTITYID_LENGTH)
{
return false;
}
Expand All @@ -576,7 +576,7 @@ inline bool ParameterSerializer<ParameterTime_t>::read_content_from_cdr_message(
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_TIME_LENGTH)
if (parameter_length < PARAMETER_TIME_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -604,7 +604,7 @@ inline bool ParameterSerializer<ParameterBuiltinEndpointSet_t>::read_content_fro
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_BUILTINENDPOINTSET_LENGTH)
if (parameter_length < PARAMETER_BUILTINENDPOINTSET_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -761,7 +761,7 @@ inline bool ParameterSerializer<ParameterSampleIdentity_t>::read_content_from_cd
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_SAMPLEIDENTITY_LENGTH)
if (parameter_length < PARAMETER_SAMPLEIDENTITY_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -1039,7 +1039,7 @@ inline bool ParameterSerializer<ParameterParticipantSecurityInfo_t>::read_conten
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_PARTICIPANT_SECURITY_INFO_LENGTH)
if (parameter_length < PARAMETER_PARTICIPANT_SECURITY_INFO_LENGTH)
{
return false;
}
Expand All @@ -1065,7 +1065,7 @@ inline bool ParameterSerializer<ParameterEndpointSecurityInfo_t>::read_content_f
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_ENDPOINT_SECURITY_INFO_LENGTH)
if (parameter_length < PARAMETER_ENDPOINT_SECURITY_INFO_LENGTH)
{
return false;
}
Expand Down
32 changes: 16 additions & 16 deletions src/cpp/fastdds/core/policy/QosPoliciesSerializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ inline bool QosPoliciesSerializer<DurabilityQosPolicy>::read_content_from_cdr_me
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_KIND_LENGTH)
if (parameter_length < PARAMETER_KIND_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -126,7 +126,7 @@ inline bool QosPoliciesSerializer<DeadlineQosPolicy>::read_content_from_cdr_mess
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_TIME_LENGTH)
if (parameter_length < PARAMETER_TIME_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -155,7 +155,7 @@ inline bool QosPoliciesSerializer<LatencyBudgetQosPolicy>::read_content_from_cdr
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_TIME_LENGTH)
if (parameter_length < PARAMETER_TIME_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -190,7 +190,7 @@ inline bool QosPoliciesSerializer<LivelinessQosPolicy>::read_content_from_cdr_me
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_KIND_LENGTH + PARAMETER_TIME_LENGTH)
if (parameter_length < PARAMETER_KIND_LENGTH + PARAMETER_TIME_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -229,7 +229,7 @@ inline bool QosPoliciesSerializer<ReliabilityQosPolicy>::read_content_from_cdr_m
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_KIND_LENGTH + PARAMETER_TIME_LENGTH)
if (parameter_length < PARAMETER_KIND_LENGTH + PARAMETER_TIME_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -263,7 +263,7 @@ inline bool QosPoliciesSerializer<OwnershipQosPolicy>::read_content_from_cdr_mes
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_KIND_LENGTH)
if (parameter_length < PARAMETER_KIND_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -292,7 +292,7 @@ inline bool QosPoliciesSerializer<DestinationOrderQosPolicy>::read_content_from_
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_KIND_LENGTH)
if (parameter_length < PARAMETER_KIND_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -323,7 +323,7 @@ inline bool QosPoliciesSerializer<ResourceLimitsQosPolicy>::read_content_from_cd
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != 12)
if (parameter_length < 12)
{
return false;
}
Expand Down Expand Up @@ -357,7 +357,7 @@ inline bool QosPoliciesSerializer<TimeBasedFilterQosPolicy>::read_content_from_c
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_TIME_LENGTH)
if (parameter_length < PARAMETER_TIME_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -397,7 +397,7 @@ inline bool QosPoliciesSerializer<PresentationQosPolicy>::read_content_from_cdr_
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_PRESENTATION_LENGTH)
if (parameter_length < PARAMETER_PRESENTATION_LENGTH)
{
return false;
}
Expand Down Expand Up @@ -516,7 +516,7 @@ inline bool QosPoliciesSerializer<HistoryQosPolicy>::read_content_from_cdr_messa
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_KIND_LENGTH + 4)
if (parameter_length < PARAMETER_KIND_LENGTH + 4)
{
return false;
}
Expand Down Expand Up @@ -553,7 +553,7 @@ inline bool QosPoliciesSerializer<DurabilityServiceQosPolicy>::read_content_from
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_TIME_LENGTH + PARAMETER_KIND_LENGTH + 16)
if (parameter_length < PARAMETER_TIME_LENGTH + PARAMETER_KIND_LENGTH + 16)
{
return false;
}
Expand Down Expand Up @@ -588,7 +588,7 @@ inline bool QosPoliciesSerializer<LifespanQosPolicy>::read_content_from_cdr_mess
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_TIME_LENGTH)
if (parameter_length < PARAMETER_TIME_LENGTH)
{
return false;
}
Expand All @@ -615,7 +615,7 @@ inline bool QosPoliciesSerializer<OwnershipStrengthQosPolicy>::read_content_from
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != 4)
if (parameter_length < 4)
{
return false;
}
Expand All @@ -638,7 +638,7 @@ inline bool QosPoliciesSerializer<TransportPriorityQosPolicy>::read_content_from
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != 4)
if (parameter_length < 4)
{
return false;
}
Expand Down Expand Up @@ -800,7 +800,7 @@ inline bool QosPoliciesSerializer<DisablePositiveACKsQosPolicy>::read_content_fr
fastrtps::rtps::CDRMessage_t* cdr_message,
const uint16_t parameter_length)
{
if (parameter_length != PARAMETER_BOOL_LENGTH)
if (parameter_length < PARAMETER_BOOL_LENGTH)
{
return false;
}
Expand Down
Loading
Loading