Repository navigation
Description
Upstream OBS bug, reported in three places: by jeiea in obsproject/obs-websocket#1344 (OBS 32.1.2: SetVideoSettings, then GetOutputList crashes in obs_output_get_width), and by walker-WSH in exeldro/obs-source-record#143 and DistroAV/DistroAV#1096 (a plugin output started after a resolution change crashes on the deleted video_t; BitRate27 reproduced it there). obsproject/obs-studio#11645 (BarryCarlyon, GetOutputList crash during a profile change) is probably the same cause. The code has not changed in this fork.
Location
libobs/obs-output.cobs_output_create_internal()(line 235): a raw (non-encoded) output storesobs_get_video()once, when it is created.obs_output_set_media()(line 912) stores a canvas's video the same way.libobs/obs.cobs_reset_video()(lines 1563-1564) frees every video mix (obs_free_canvas_mixes(),obs_free_video()), which closes theirvideo_t, and creates new ones. Nothing points existing outputs at the new mixes.- Every later
obs_output_get_width/height()(lines 1284, 1312),obs_output_video()orobs_output_start()(line 2546) of such an output uses the freedvideo_t.
Class
Use after free (crash, or wrong sizes when the memory has been reused).
How it is reached
- obs-websocket
SetVideoSettings, thenGetOutputListorGetOutputStatus: it reads the size of every output, including idle raw ones such as the virtual camera. - Changing the base or output resolution (Settings > Video, or a profile change), then starting a plugin output that was created before: DistroAV's NDI output, Source Record, vertical canvas outputs.
- Whether it crashes depends on the allocator: the new mix often gets the freed memory back, which hides the bug. That is why it is hard to reproduce by hand.
Reproduced headlessly against libobs on master, in both libobs lanes and in the current release AppImage (Rust libobs): a raw output created before obs_reset_video() still holds the old video_t after it. Under ASan, obs_output_get_width() after the reset is a heap-use-after-free in video_output_get_width(), freed by video_output_close() in obs_reset_video().
Upstream work
obsproject/obs-studio#11686 by walker-WSH (closed unmerged in 2025-10) adds signals around the reset so plugins can drop their video_t. It does not move existing outputs. exeldro asked in its review for the release signal to come before the free. No upstream fix for the outputs themselves.
Proposed fix and failing test
Fix: obs_reset_video() records each mix's video_t and the canvas that owns it before freeing them. Afterwards it points every output that held one at the new mix of the same canvas, or at nothing when that mix is not recreated (views). It also emits a core_video_release signal before the free (ported from obsproject/obs-studio#11686), so plugins holding their own video_t can drop it; the existing video_reset signal says when the new mixes are ready.
RED test (cmocka, test_raw_output_video_reset). It registers a raw video output, starts core video under a private display, and resets the video under it. Four cases:
- the output's size follows two resets;
- the output starts after a reset and receives frames;
- an output on a second canvas follows that canvas's new mix and keeps its own size;
core_video_releaseis emitted once, before the old mixes are freed.
While the reset runs, the test pins the old video_t addresses so the allocator cannot hand them back to the new mixes. The stale pointer is compared, never read, so the cases fail the same way every run without ASan. All four fail today.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 13, 2026
Claiming: this issue.
test_raw_output_video_reset(4 cases): afterobs_reset_video, a raw output still holds the freedvideo_t(size, start, canvas output, release signal). Fails 4 of 4 on master and against the current release AppImage.core_video_releasesignal from libobs: Add new signals for video reset obsproject/obs-studio#11686 (walker-WSH, co-author).PR today.
rdoupe commentedon Oct 13, 2026
@jeiea you reported this in obsproject/obs-websocket#1344 (
SetVideoSettings, thenGetOutputListcrashing inobs_output_get_width), so a heads-up: it's fixed here in obs-rust by #470, with a regression test.Cause: a raw output saves the video mix pointer once, when it's created, and
obs_reset_videofrees every mix without pointing the outputs at the new ones. Any later call that reads the output's size, or starts it, uses freed memory. Your websocket sequence is the shortest way to hit it; plugin outputs started after a resolution change crash the same way (reported for obs-source-record and DistroAV). After the reset, each output now moves to its canvas's new mix. The fix ports thecore_video_releasesignal from walker-WSH's upstream PR obsproject/obs-studio#11686.Workaround on stock OBS: after changing the base or output resolution, restart OBS before querying or starting outputs (outputs created at startup then hold the new mix).
It will be in the next obs-rust daily release after 0.1.0-beta.20261012: https://github.com/obs-rust/obs-studio/releases (on Arch it's
obs-studio-rust-gitin the AUR). obs-rust is an AI-assisted fork of OBS.If you get a chance to try it, a reply here on whether your
SetVideoSettingsthenGetOutputListsequence still crashes would really help.libobs: Move raw outputs to the new video mix on obs_reset_video (obs…