Repository navigation
librtmp: Ignore invalid chunk sizes from the server - #119
Closed
b7216309-jpg wants to merge 2 commits into
Closed
b7216309-jpg wants to merge 2 commits into
b7216309-jpg wants to merge 2 commits into
Conversation
Sends Set Chunk Size messages through RTMP_ClientPacket: sizes 1 to 0x7FFFFFFF are taken, a short message is ignored, and 0 and sizes with bit 31 set must be ignored. The last case fails until the next commit. test_rtmp_chunk_size is built like test_rtmp_error, so both now come from one foreach. Refs obs-rust#100 Co-Authored-By: Claude Opus 5.5 <[email protected]>
HandleChangeChunkSize stored the server's Set Chunk Size value in the int m_inChunkSize unchecked. RTMP_ReadPacket reads min(remaining, m_inChunkSize) bytes per chunk, and ReadN returns n unchanged for n <= 0, so: - 0: no chunk ever adds to the packet, which never completes, and the send thread keeps reading headers instead of stopping - bit 31 set: the size is negative and m_nBytesRead goes backwards, below the body allocation Ignore sizes outside RTMP 1.0's 1 to 0x7FFFFFFF, with an error in the log. Fixes obs-rust#100 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
Closing in favor of #115, which was opened first with the same fix. I offered the test there. |
Member
Member
This was referenced Oct 10, 2026
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.
Fixes #100.
HandleChangeChunkSizestored the server's Set Chunk Size value in theint m_inChunkSizeunchecked.RTMP_ReadPacketreadsmin(remaining, m_inChunkSize)bytes per chunk, andReadNreturnsnunchanged forn <= 0, so its error check passes:m_nBytesReadgoes backwards, below the body allocationChange
Sizes outside RTMP 1.0 §5.4.1's
1..0x7FFFFFFFare ignored, with an error in the log; the previous chunk size stays.Tests
New
test/cmocka/test_rtmp_chunk_size.csends Set Chunk Size packets throughRTMP_ClientPacket:0x7FFFFFFFare taken0x80000000and0xFFFFFFFFleave the size unchangedIt is built exactly like
test_rtmp_error(same sources, defines and libraries), so the CMake block is now aforeachover both tests.The test commit comes first. Locally (MSVC, minimal cmocka stand-in, unused connect code left unresolved) it fails against the old
rtmp.c(0 != 4096) and passes with the fix. CI is the first real build.🤖 Generated with Claude Code