Repository navigation
libobs, frontend: Don't crash on NULL output id - #14050
samirakash248-max wants to merge 2 commits into
Conversation
Check if id is NULL in find_output() before comparing with strcmp(), and initialize output variables to nullptr in OBSBasicSettings_Stream. Fixes a crash (segfault) when opening Settings with a streaming protocol that has no registered outputs or when querying supported codecs. Closes obsproject#12843
|
One could argue that passing NULL to |
|
Agreeing with R1CH and also curious what circumstances can lead to having a streaming protocol with no outputs. |
Address review feedback by keeping libobs find_output() unchanged and properly handling null output lookups in the frontend caller. Check if protocol outputs are registered in FindProtocol() for SRT and RIST, and ensure output is non-null before querying supported codecs in OBSBasicSettings_Stream.
|
Thanks for the feedback @notr1ch and @Warchamp7! That makes total sense regarding I've reverted the change in
|
Description
Adds a NULL check in
find_output()withinlibobs/obs-output.cbefore comparing strings withstrcmp(), and initializesoutputpointers tonullptrinOBSBasicSettings_Stream.cpp.Fixes #12843
Motivation and Context
When opening Settings with a streaming service protocol that has no registered outputs or when querying supported codecs with a null output ID,
find_output(id)receives a NULL pointer. Becausefind_output()did not validate the input ID before invokingstrcmp(), it resulted in a segmentation fault.With this change,
find_output()safely returnsNULLwhen passed a NULL pointer, and public getters return their expected not-found values instead of crashing.How Has This Been Tested?
find_output(NULL)and related getters (obs_get_output_supported_video_codecs(NULL)) safely returns NULL without crashing.Types of changes
Checklist: