Skip to content

Guard RTMP sink NIFs against closed or unready streams - #132

Closed
lawik wants to merge 1 commit into
membraneframework:masterfrom
lawik:fix/sink-stream-state-guards
Closed

lawik wants to merge 1 commit into
membraneframework:masterfrom
lawik:fix/sink-stream-state-guards

Conversation

@lawik

@lawik lawik commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Found with Claude. If it is not useful, kill it. Posted with permission from mat_hek.

flush_and_close_stream freed output_ctx but left the pointer set, so any later NIF call used freed memory. write_*_frame before try_connect or before the header was written handed the FLV muxer a NULL pb. NULL the context after freeing and return an error from every entry point in those states.

flush_and_close_stream freed output_ctx but left the pointer set, so any
later NIF call used freed memory. write_*_frame before try_connect or
before the header was written handed the FLV muxer a NULL pb. NULL the
context after freeing and return an error from every entry point in those
states.
@lawik
lawik requested a review from varsill as a code owner October 27, 2026 22:06
@varsill

varsill commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Hello! We already handle it partially within #134 so I will close this PR and implement the missing parts there. I will then release a new version of the plugin. Thanks for bringing this up!

@varsill varsill closed this Nov 9, 2026
varsill added a commit that referenced this pull request Nov 9, 2026
Return an error from every NIF entry point once the output context is freed,
refuse to write frames before the FLV header exists, and raise instead of
handing FFmpeg a NULL connection when the header or trailer would be written
before try_connect. Based on #132.
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