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

Document and assert RTPS entity pointers lifetime [11579] #1967

Merged
merged 4 commits into from
May 18, 2021

Conversation

EduPonz
Copy link

@EduPonz EduPonz commented May 17, 2021

This PR prevents accessing to an already deleted RTPSParticipant. This case may arise when an application does:

  1. Create an RTPSParticipant an save the pointer
  2. Call to RTPSDomain::stopAll()
  3. Call to RTPSDomain::removeRTPSParticipant() with the saved pointer.

stopAll() already deleted all the created RTPSParticipants, so accessing to the memory segment using the pointer obtained on creation is dangerous at best. We can not prevent applications to manipulate the pointer after calling stopAll() (thus breaking the contract), but we definitely should not do so within Fast DDS.

EduPonz added 2 commits May 17, 2021 10:03
Signed-off-by: EduPonz <eduardoponz@eprosima.com>
Signed-off-by: EduPonz <eduardoponz@eprosima.com>
@EduPonz EduPonz requested a review from MiguelCompany May 17, 2021 09:48
@EduPonz EduPonz changed the title Do not access an already removed RTPS participant in RTPSDomain::removeRTPSParticipant Do not access an already removed RTPS participant in RTPSDomain::removeRTPSParticipant [11579] May 17, 2021
src/cpp/rtps/RTPSDomain.cpp Outdated Show resolved Hide resolved
Signed-off-by: EduPonz <eduardoponz@eprosima.com>
src/cpp/rtps/RTPSDomain.cpp Outdated Show resolved Hide resolved
src/cpp/rtps/RTPSDomain.cpp Outdated Show resolved Hide resolved
src/cpp/rtps/RTPSDomain.cpp Show resolved Hide resolved
Signed-off-by: EduPonz <eduardoponz@eprosima.com>
@EduPonz EduPonz force-pushed the bugfix/not_access_removed_rtps_participant branch from fd5ca17 to ac7b6ab Compare May 18, 2021 06:55
@EduPonz EduPonz changed the title Do not access an already removed RTPS participant in RTPSDomain::removeRTPSParticipant [11579] Document and assert RTPS entity pointers lifetime [11579] May 18, 2021
@MiguelCompany MiguelCompany merged commit 836e0d3 into master May 18, 2021
@MiguelCompany MiguelCompany deleted the bugfix/not_access_removed_rtps_participant branch May 18, 2021 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants