Skip to content

Commit

Permalink
Refs #20549: Fix review
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
  • Loading branch information
Mario-DL committed Mar 8, 2024
1 parent 3a2665d commit 74b5ea9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/cpp/rtps/messages/MessageReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,13 +843,16 @@ bool MessageReceiver::proc_Submsg_Data(
if (dataFlag || keyFlag)
{
uint32_t payload_size;
// To prevent integer overflow of variable payload_size
if (smh->submessageLength < RTPSMESSAGE_DATA_EXTRA_INLINEQOS_SIZE + octetsToInlineQos + inlineQosSize )
const uint32_t submsg_no_payload_size =
RTPSMESSAGE_DATA_EXTRA_INLINEQOS_SIZE + octetsToInlineQos + inlineQosSize;

// Prevent integer overflow of variable payload_size
if (smh->submessageLength < submsg_no_payload_size)
{
return false;
}
payload_size = smh->submessageLength -
(RTPSMESSAGE_DATA_EXTRA_INLINEQOS_SIZE + octetsToInlineQos + inlineQosSize);

payload_size = smh->submessageLength - submsg_no_payload_size;

if (dataFlag)
{
Expand Down

0 comments on commit 74b5ea9

Please sign in to comment.