Skip to content

Fix data race in DebugFile class (Coverity CID 901301-901311)#859

Merged
lemenkov merged 1 commit into
SIPp:masterfrom
lemenkov:new_coverity
Mar 12, 2026
Merged

Fix data race in DebugFile class (Coverity CID 901301-901311)#859
lemenkov merged 1 commit into
SIPp:masterfrom
lemenkov:new_coverity

Conversation

@lemenkov
Copy link
Copy Markdown
Member

cc @orgads

Move std::lock_guard acquisition before checking fp pointer to prevent race conditions. The previous pattern checked fp without holding the lock, then acquired the lock and checked again, but another thread could modify fp between the unlocked check and lock acquisition.

Comment thread src/rtpstream.cpp Fixed
@lemenkov lemenkov force-pushed the new_coverity branch 2 times, most recently from fd19ef6 to c669284 Compare March 11, 2026 12:02
Move std::lock_guard acquisition before checking fp pointer to prevent
race conditions. The previous pattern checked fp without holding the
lock, then acquired the lock and checked again, but another thread could
modify fp between the unlocked check and lock acquisition.

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
Assisted-by: Claude (Anthropic) <https://claude.ai>
Copy link
Copy Markdown
Contributor

@orgads orgads left a comment

Choose a reason for hiding this comment

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

I think the report is false positive, because the file is never closed while multiple threads are running, but since mutex lock is very fast on most cases I'll pass.

@lemenkov lemenkov merged commit 5e628f8 into SIPp:master Mar 12, 2026
9 checks passed
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