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

[core] Fixed bug: srt_accept failure may make accepted socket leak #1884

Merged

Conversation

ethouris
Copy link
Collaborator

@ethouris ethouris commented Mar 23, 2021

When the socket picked up from the accept queue turns out to have address that cannot be written back to the sockaddr buffer because it's too small, this function returns an error, but the socket remains valid and could leak this way. As this socket can no longer be returned, it must be set broken. Although theoretically this call could be repeated with fixed value, it's unlikely that an application can do a repeated call and inteligently fix the problem in runtime; instead it will rather fail completely and this way the socket will be left leaked.

Draft until: #2681 (prematurely merged)

@ethouris ethouris added Type: Bug Indicates an unexpected problem or unintended behavior [core] Area: Changes in SRT library core [tests] Area: Unit tests labels Mar 23, 2021
srtcore/api.cpp Outdated
{
// Check if the length of the buffer to fill the name in
// was large enough.
const int len = b->second.size();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using m_PeerAddr to avoid locking s->m_ControlLock?

@maxsharabayko maxsharabayko modified the milestones: v1.4.3, v1.4.4 Apr 19, 2021
@maxsharabayko maxsharabayko modified the milestones: v1.4.4, v1.4.5 Aug 12, 2021
@maxsharabayko maxsharabayko modified the milestones: v1.4.5, Next Release Apr 25, 2022
@maxsharabayko maxsharabayko modified the milestones: v1.5.1, Next release Sep 12, 2022
@maxsharabayko maxsharabayko modified the milestones: v1.5.2, v1.6.0 Feb 10, 2023
@ethouris
Copy link
Collaborator Author

ethouris commented Mar 9, 2023

Things have changed a bit, please merge #2681 first.

@ethouris ethouris marked this pull request as draft March 9, 2023 22:56
@ethouris ethouris marked this pull request as ready for review September 13, 2023 10:44
Copy link

codecov bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.73%. Comparing base (09f35c0) to head (d5a7604).
Report is 80 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1884      +/-   ##
==========================================
+ Coverage   67.20%   67.73%   +0.53%     
==========================================
  Files         102      103       +1     
  Lines       20269    20686     +417     
==========================================
+ Hits        13622    14012     +390     
- Misses       6647     6674      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maxsharabayko maxsharabayko merged commit 72303d7 into Haivision:master Jun 12, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core [tests] Area: Unit tests Type: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants