Skip to content

Commit

Permalink
Implement a validity check for firstSN (#3274)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
squizz617 authored Mar 16, 2023
1 parent 60fb557 commit 3aa3ee0
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 @@ -1056,6 +1056,13 @@ bool MessageReceiver::proc_Submsg_Heartbeat(
SequenceNumber_t lastSN;
CDRMessage::readSequenceNumber(msg, &firstSN);
CDRMessage::readSequenceNumber(msg, &lastSN);

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

0 comments on commit 3aa3ee0

Please sign in to comment.