You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: libobs/graphics: gs_matrix_scale3f crashes without a graphics context (and gs_reset_blend_state logs the wrong name) #2518
gs_matrix_scale3f dereferences NULL when it is called without a graphics context on the thread. The other thirteen gs_matrix_* functions check gs_valid() first, which logs "<function>: called while not in a graphics context" (at LOG_DEBUG) and returns; this one reads thread_graphics directly (top_matrix(thread_graphics)), so a plugin or a script that calls it outside a graphics context crashes OBS instead of getting the log line.
gs_reset_blend_state checks with gs_valid("gs_preprocessor_name"), so its log line names the wrong function.
Both are in upstream OBS master unchanged (libobs/graphics/graphics.c); 2 is from the null/context warnings of 2015 (d242004).
Who can reach it
Plugins and scripts (gs_matrix_scale3f and gs_reset_blend_state are EXPORT, and obslua and obspython include all of graphics.h). OBS's own callers run with a graphics context.
Fix
gs_matrix_scale3f: if (!gs_valid("gs_matrix_scale3f")) return;, as its neighbours.
One PR. RED: a cmocka test without a graphics context, with a log handler that also records LOG_DEBUG: gs_matrix_scale3f returns and logs gs_matrix_scale3f: called while not in a graphics context (now: a crash), and gs_reset_blend_state logs its own name (now: gs_preprocessor_name). GREEN: the two changes. The state stacks port (#2517) builds on the fixed C.
Activity
vpacher commentedon Oct 26, 2026
Claiming: #2518
One PR: RED (a cmocka test without a graphics context and a log handler), GREEN (the two changes).
fixup: features ledger line for #2518
libobs/graphics: Check the graphics context in gs_matrix_scale3f (obs…