obsproject / obsproject/obs-studio

macOS: GetInputPropertiesListPropertyItems on screen_capture's display_uuid crashes OBS (strlen(NULL) on the placeholder list entry)

Open Beginner friendly
#13,905 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
76.4k
Forks
10.2k
Avg merge
4d 23h
Merged PRs (30d)
12

Description

Operating System Info

macOS 15

Other OS

macOS 15.7.9 (24G830), Intel

OBS Studio Version

32.2.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

Inline below (the crash is deterministic from obs-websocket, no UI involved; happy to attach a full log on request).

OBS Studio Crash Log URL

Inline below.

Expected Behavior

GetInputPropertiesListPropertyItems for the display_uuid property of a screen_capture (macOS Screen Capture / ScreenCaptureKit) input returns the list of displays, like it does for the window property.

Current Behavior

OBS crashes (SIGSEGV in strlen) every time the request is made, with or without Screen Recording permission granted to OBS.

Crash log (faulting thread; obs-websocket is stripped):

Exception Type:  EXC_BAD_ACCESS (SIGSEGV), KERN_INVALID_ADDRESS at 0x0000000000000000
Thread 36 Crashed:
0  libsystem_platform.dylib   _platform_strlen + 18
1  obs-websocket              0x... (+76847)
2  obs-websocket              0x... (+485625)
3  obs-websocket              0x... (+333854)
4  obs-websocket              0x... (+240716)
5  obs-websocket              0x... (+873065)
6  obs-websocket              0x... (+830871)
7  QtCore
8  QtCore
9  libsystem_pthread.dylib    _pthread_start + 115

OBS log tail (the request arrives right after the source is created; nothing else is logged before the process dies):

08:17:30.805: User added source 'rigger.probe.capture' (screen_capture) to scene 'rigger.probe'
Cause (from source)

plugins/mac-capture/mac-sck-common.m, build_display_list() adds a placeholder entry at the top of the display list with a NULL string value:

// Add null entry to the top of the content list, to avoid inadvertent capture of the first enumerated display
// when opening the source's properties window
obs_property_list_add_string(display_list, " ", NULL);

plugins/obs-websocket/src/utils/Obs_ArrayHelper.cpp, GetListPropertyItems() builds a JSON string from every item's value:

} else if (itemFormat == OBS_COMBO_FORMAT_STRING) {
    itemData["itemValue"] = obs_property_list_item_string(property, i);

nlohmann::json constructing a string from a const char* that is NULL calls strlen(NULL). The window list's placeholder is an int (kCGNullWindowID), so window works; display_uuid (and the application list, if it uses the same pattern) does not.

Steps to reproduce
  1. Any macOS with OBS 32.2.2 and obs-websocket 5.7.4 (bundled).
  2. CreateInput with inputKind: "screen_capture" (any settings) in any scene.
  3. GetInputPropertiesListPropertyItems with propertyName: "display_uuid" for that input.
  4. OBS exits with the crash above.
Suggested fix

Either side fixes it; both would be robust:

  • mac-capture: obs_property_list_add_string(display_list, " ", ""); (an empty string instead of NULL for the placeholder).
  • obs-websocket: null-check the item name/string value in GetListPropertyItems and emit nullptr (JSON null) instead of constructing a std::string from NULL.

We carry the one-line mac-capture change as a local patch and can send it as a PR if that is the preferred side.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read plugins/mac-capture/mac-sck-common.m around build_display_list() and plugins/obs-websocket/src/utils/Obs_ArrayHelper.cpp around GetListPropertyItems(). Reproduce the display_uuid request with obs-websocket, then verify that the placeholder value is handled without a crash and that GetInputPropertiesListPropertyItems returns a usable display list.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp, objective-c
Domain
api, desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.