Repository navigation
Description
Summary
When a RIST stream fails to open, the passphrase, username and password are freed twice, once inside librist_open and again when the caller cleans up. Anyone streaming to a rist:// URL with a passphrase, username or password set can hit heap corruption or a crash on a failed start instead of a clean error. Severity: medium. It needs a failed start, but the result is memory corruption in the main process.
Steps / trigger
- Create the
ffmpeg_mpegts_muxeroutput with a service that supplies an encryption passphrase (or a username and password). - Start it with a
rist://URL that makeslibrist_openfail. Two simple ways: a URL that does not parse, or a URL withaes-type=128and no secret while the service passphrase is set. - The start fails and both cleanup calls free the same strings. No RIST receiver is needed.
Cause
Line numbers are against current master.
plugins/obs-ffmpeg/obs-ffmpeg-rist.h:101-106:librist_closecallsbfreeonsecret,usernameandpasswordbut leaves the pointers set.plugins/obs-ffmpeg/obs-ffmpeg-rist.h:189,:196,:231:librist_opencallslibrist_closeitself on the parse, missing-secret and generic error paths, then returns the error.plugins/obs-ffmpeg/obs-ffmpeg-mpegts.c:355-360:connect_mpegts_urlruns itsfail:path on that error and callslibrist_close(uc)a second time on the same context. The credentials were allocated at:328-340.
The second close frees the three dangling pointers again. This is plugin C code, so it is the same with ENABLE_RUST_LIBOBS OFF and ON.
Proposed fix
Set secret, username and password to NULL right after freeing them in librist_close. The context pointer is already guarded, so after that the function is safe to call twice and the caller's cleanup becomes a no-op for the credentials. The regression test drives the real librist_open and librist_close with the external librist calls replaced, and checks that allocations return to baseline after open and that the three pointers are NULL before the caller's second close.
I'd like to work on this; a fix with a regression test is ready.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 13, 2026
@chriscoveries go ahead: please open the PR with the RED test commit first, then the fix (one PR per issue, targeting master). Marking it claimed for you.
chriscoveries commentedon Oct 14, 2026
Releasing this one. We're backed up on CI and won't get it landed soon, so anyone who wants it is welcome to take it.
If it helps, our RED test and fix are on the fork branch
fix/rist-open-failure-cleanup. They passed review on our side but haven't been through CI, so reuse them or start fresh, whichever you prefer.obs-ffmpeg: Clear RIST credentials on close so open failure frees the…