RTC2RTMP: Fix sequence number wraparound assertion crashes. v6.0.177#4491
Merged
winlinvip merged 3 commits intoossrs:6.0releasefrom Sep 15, 2025
Merged
RTC2RTMP: Fix sequence number wraparound assertion crashes. v6.0.177#4491winlinvip merged 3 commits intoossrs:6.0releasefrom
winlinvip merged 3 commits intoossrs:6.0releasefrom
Conversation
winlinvip
added a commit
that referenced
this pull request
Sep 15, 2025
…v7.0.89 (#4491) The issue occurred when srs_rtp_seq_distance(start, end) + 1 resulted in values <= 0 due to sequence number wraparound (e.g., when end < start). This caused assertion failures and server crashes. SrsRtcFrameBuilder::check_frame_complete(): Added validation to return false for invalid sequence ranges instead of asserting. However, it maybe cause converting RTC to RTMP stream failure, because this issue should be caused by the problem of sequence number of RTP, which means there potentially be stream problem in RTC stream. Even so, changing assert to warning logs is better, because SRS should not crash when stream is corrupt. --------- Co-authored-by: OSSRS-AI <winlinam@gmail.com>
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.
The issue occurred when srs_rtp_seq_distance(start, end) + 1 resulted in values <= 0
due to sequence number wraparound (e.g., when end < start). This caused assertion
failures and server crashes.
SrsRtcFrameBuilder::check_frame_complete(): Added validation to return false
for invalid sequence ranges instead of asserting.
However, it maybe cause converting RTC to RTMP stream failure, because this issue
should be caused by the problem of sequence number of RTP, which means there potentially
be stream problem in RTC stream. Even so, changing assert to warning logs is better,
because SRS should not crash when stream is corrupt.