Fix segfault in play media with record-egress enabled#2086
Closed
fergusean wants to merge 1 commit intosipwise:masterfrom
Closed
Fix segfault in play media with record-egress enabled#2086fergusean wants to merge 1 commit intosipwise:masterfrom
fergusean wants to merge 1 commit intosipwise:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix a segmentation fault that occurred when issuing a "play media" command while call recording with
--record-egresswas active.Root Cause
When the media player constructed a synthetic
struct media_packetfor the egress-recording path inmedia_player.c, it left themediafield uninitialized (NULL). Thedump_packet_pcap()function inrecording.cthen unconditionally dereferencedmp->media->monologue, causing a segfault.Changes Made
daemon/media_player.c: Initialize the
mediafield in the syntheticstruct media_packettosink->mediawhen constructing packets for the media player send timer. This ensures the media context is available for the egress recording path.daemon/recording.c: Add a defensive NULL check in
dump_packet_pcap()to safely handle cases wheremp->mediaormp->media->monologuemight be NULL, preventing crashes from incomplete packet structures.t/auto-daemon-tests-record-egress-play-media.pl: Add comprehensive regression test covering:
Testing
The new test verifies the fix works correctly and prevents regression of this crash scenario when using
--record-egresswith the play media feature.