Repository navigation
Description
Location
libobs/obs.c.h, on master at 0e53b9f:
float obs_get_video_sdr_white_level(void)
{
struct obs_core_video *video = &obs->video;
return video->graphics ? video->sdr_white_level : 300.f;
}
float obs_get_video_hdr_nominal_peak_level(void)
{
struct obs_core_video *video = &obs->video;
return video->graphics ? video->hdr_nominal_peak_level : 1000.f;
}
bool obs_get_audio_info(struct obs_audio_info *oai)
{
struct obs_core_audio *audio = &obs->audio;
...
if (!oai || !audio->audio)
return false;
bool obs_nv12_tex_active(void)
{
const obs_canvas_t *canvas = obs->data.main_canvas;
...
}
bool obs_p010_tex_active(void)
{
const obs_canvas_t *canvas = obs->data.main_canvas;
...
}(lines 1650-1660, 1682-1695 and 3406-3418.)
Class
NULL pointer dereference (crash) before obs_startup or after obs_shutdown.
How it is reached
obs_get_video_info returns false when there is no core (#1509), but these five getters read through the global obs without checking it. With no core (before obs_startup, or after obs_shutdown, which sets obs to NULL), each one dereferences NULL: obs->video.graphics, obs->audio.audio or obs->data.main_canvas. #2253 guarded the two texture checks only for a main canvas with no mix, not for no core at all.
A plugin, script or headless tool that calls one of them outside the core's lifetime crashes, where obs_get_video_info gives the "no video" answer. obs_get_audio_info2 calls obs_get_audio_info first, so it crashes the same way.
No upstream issue.
Proposed fix and failing test
The #1509 pattern: with no core, each returns its existing "no video/audio" answer and nothing else changes:
obs_get_video_sdr_white_level: 300obs_get_video_hdr_nominal_peak_level: 1000obs_get_audio_info: false,oaiuntouched (soobs_get_audio_info2returns false too)obs_nv12_tex_active,obs_p010_tex_active: false
Test (RED first): a cmocka test that never calls obs_startup and calls each getter, each in its own case so one crash doesn't hide the others. RED: each case crashes with SIGSEGV. GREEN: the defaults above, with the out-structs left as they were.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 27, 2026
Claiming: #2566.
obs_get_audio_info2) with no core, one case each; each crashes on master.PR expected today.
test: Check getters with no core
libobs: Guard the level and texture getters
test: Skip the no-core cases when a core exists
docs: Mark the no-core getters line pending
rdoupe commentedon Oct 27, 2026
Fixed by the PR that guards the level and texture getters (#2569), merged as 3bddf1b. With no core (before
obs_startup()or afterobs_shutdown()),obs_get_video_sdr_white_level()returns 300,obs_get_video_hdr_nominal_peak_level()returns 1000,obs_get_audio_info()(and soobs_get_audio_info2()) returns false with the out-struct untouched, andobs_nv12_tex_active()/obs_p010_tex_active()return false. Nothing changes while the core exists. The newtest_no_core_getterscovers each getter in its own case.Left: nothing for this bug, so there is no follow-up issue. The test checks the never-started case only; after
obs_shutdown()the getters take the same no-core branch.libobs: Guard the level and texture getters (#2569)
libobs: Guard the level and texture getters (obs-rust#2569)
build(cmake): compile C with -Wmissing-prototypes and -Wstrict-protot…
fix(libobs): check the core before taking &obs->audio (obs-rust#3363) (…