Repository navigation
obs-ffmpeg: zero-init missing-encoder error, publish connecting before worker (split from #1464) - #1554
Merged
Conversation
…e (RED) Split from #1464. Fails on master: ffmpeg_video_encoder_init() prints into an uninitialized dstr, and ffmpeg_output_start() overwrites connecting after a worker that already finished cleared it.
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.
Split from #1464 (the obs-ffmpeg output/encoder part).
obs-ffmpeg-video-encoders.c.h):ffmpeg_video_encoder_init()printed "Couldn't find encoder" into an uninitializedstruct dstr, sodstr_printfreallocated leftover stack garbage. It is now= {0}.obs-ffmpeg-output.c.h):ffmpeg_output_start()assignedconnecting = (ret == 0)afterpthread_create; if the connect worker already finished and cleared it, the flag stuck at true and every later start was refused.connectingis now set before the worker starts and cleared only if creation fails.Evidence (commit 1 RED, commit 2 GREEN):
test/cmocka/test_ffmpeg_encoder_missing.c: includes the encoder file withdstr_printfreplaced by a recorder; the stack is filled with 0xA5 right before the call so the uninitialized case is deterministic in practice. Asserts the dstr is zeroed and the error text is set.test/cmocka/test_ffmpeg_output_connecting.c: includes the output file withpthread_createreplaced. Limit: the real bug is a thread race; the stand-in reproduces the losing ordering deterministically by doing what a finished worker does (clearconnecting) before returning, rather than running the real connect. Assertsconnectingis false afterwards and a second start is accepted; also covers create failure.Not built locally (no FFmpeg/cmocka on the shared host);
./lintpasses; PR CI Tier 2 is the gate. Ledger line added to docs/features.md.