Skip to content

Commit

Permalink
Implement a validity check for firstSN (#3383)
Browse files Browse the repository at this point in the history
* Implement a validity check for firstSN (#3274)

* Implement a validity check for firstSN

Following 8.3.8.6.3 of DDS-RTPS 2.5.
This fixes issue #3236.

Signed-off-by: Seulbae Kim <squizz617@gmail.com>

* fix typo

Signed-off-by: Seulbae Kim <squizz617@gmail.com>

* add test input for issue #3236 (pr #3274)

Signed-off-by: Seulbae Kim <squizz617@gmail.com>

---------

Signed-off-by: Seulbae Kim <squizz617@gmail.com>
(cherry picked from commit 3aa3ee0)

* Refs #17717: Logging Macro fix

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

---------

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Co-authored-by: Seulbae Kim <squizz617@gmail.com>
Co-authored-by: Mario Dominguez <mariodominguez@eprosima.com>
  • Loading branch information
3 people authored Mar 24, 2023
1 parent 38b459f commit e02775a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Binary file not shown.
7 changes: 7 additions & 0 deletions src/cpp/rtps/messages/MessageReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,13 @@ bool MessageReceiver::proc_Submsg_Heartbeat(
SequenceNumber_t lastSN;
CDRMessage::readSequenceNumber(msg, &firstSN);
CDRMessage::readSequenceNumber(msg, &lastSN);

SequenceNumber_t zeroSN;
if (firstSN <= zeroSN)
{
logWarning(RTPS_MSG_IN, IDSTRING "Invalid Heartbeat received (" << firstSN << " <= 0), ignoring");
return false;
}
if (lastSN < firstSN && lastSN != firstSN - 1)
{
logWarning(RTPS_MSG_IN, IDSTRING "Invalid Heartbeat received (" << firstSN << ") - (" <<
Expand Down

0 comments on commit e02775a

Please sign in to comment.