Skip to content

Fix: siprec segfault when copy delete #3632

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kicey
Copy link

@Kicey Kicey commented Apr 22, 2025

Summary

To fix issue #3602.
In short, the siprec unreference the dialog recorded too early. After releasing the memory of the rtp_relay_ctx in dialog, check of the dialog (by pointer) is not valid. Do failover and end the recording(copy delete) both access the dialog (access call id, rtp relay context, etc). So, I try to unreference the dialog when the recording dialog ends.

Details

The code following will unreference the dialog when the transaction end,

if (srec_tm.register_tmcb(msg, 0, TMCB_RESPONSE_OUT, tm_start_recording,
ss, tm_src_unref_session) <= 0) {

And if the recorded dialog end before the srs respond (before siprec get the b2b notify), the srec_b2b_notify's processing of the dialog will be uncertain. So, the segment fault is likely to raise here (when invoke rtp_relay copy_delete or rebuild the invite body).

To simplify the code, I invoke the src_unref_session in the srec_logic_destroy function and use the keep_sdp flag. If this is inappropriate, please let me know.

Solution

Make siprec unref the dialog when the recording end.

Compatibility

The fix works well with 3.4.11.

Closing issues

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.

2 participants