Skip to content

test: Cover obs-websocket list items with a NULL name or value - #2251

Merged
zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:test/ws-list-item-null
Oct 24, 2026
Merged

zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:test/ws-list-item-null

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1266

What and why

The fix for #1266 is already on master. obs-rust/obs-websocket#18, a port of obsproject/obs-websocket#1355, reports a list item with a NULL name or NULL string value as an empty string. Before, GetInputPropertiesListPropertyItems aborted OBS on such an item, and the macOS Screen Capture display and application lists always start with one (upstream obsproject/obs-studio#13905). The fix came in with the plugins/obs-websocket bump in #1996 (0d663eefb to 99dd8468b; master's pin 30d6f51 still contains it). The regression test was never posted, so #1266 is still open. This PR adds only the test and the fix's line in docs/features.md. It does not move the submodule.

test_ws_list_property_items compiles the plugin's Utils::Obs::ArrayHelper from the submodule against libobs and builds list properties directly. It needs no libobs startup and no display:

  • string_items_reported: ordinary string items keep their names and values (guard).
  • null_string_value_reported_empty: the macOS placeholder, (" ", NULL), is reported with an empty value.
  • null_item_name_reported_empty: items without a name, in a string list and an int list, are reported with an empty name.

If the helper throws, the case fails with the exception message rather than aborting the test. Registered as test/cmocka/tests.d/test_ws_list_property_items.cmake (Linux, nlohmann_json found).

RED → GREEN

  • RED: against the pre-fix submodule. With plugins/obs-websocket checked out at 0d663ee (ws#18's parent, the fork commit just before the fix; not committed), 2 of 3 cases fail on C, hybrid and libobs-c-reference: null_string_value_reported_empty and null_item_name_reported_empty, each with GetListPropertyItems threw 'basic_string: construction from null is not valid'. string_items_reported passes.
  • GREEN: at master's pin 30d6f51, test_ws_list_property_items passes 3/3 on C, hybrid and libobs-c-reference. The other 10 test_ws_* tests pass on all three lanes. Exported symbols: 1766, the same set on all three libraries. Local gate: --test-diff origin/master 3736 passed, 6 skipped (whole workspace in scope) and --lane lint ok.
  • Real app: no app change; the fix shipped in plugins/obs-websocket: bump for the parallel RequestBatch notify fix #1996.

Checklist

  • Base is master
  • I claimed the issue, or no one else has an open PR for it
  • Characterization test (if the unit had none), then RED, then GREEN commits (test-only PR: RED shown against the pre-fix submodule, GREEN at master's pin)
  • User-visible change: its line in docs/features.md is added or updated
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite (gate passed locally, head not stamped)
  • Warning or flag changes (-W..., ratchets): not applicable
  • Intentional differences from C listed in the parity test header and rust/README.md (ports): not applicable

(Rebased onto current master, which only brought unrelated commits, as 192214cfd; the runs above name the commits they ran on.)

obs-websocket's GetInputPropertiesListPropertyItems turns every item of
a list property into json. Utils::Obs::ArrayHelper::GetListPropertyItems
used to put the const char * from obs_property_list_item_name() and
obs_property_list_item_string() straight into the json value, and a
NULL pointer throws std::logic_error ("basic_string: construction from
null is not valid") on the websocket thread, so OBS aborted. libobs
keeps such items as they were added: the macOS Screen Capture source
puts a placeholder with a NULL value at the top of its display and
application lists (upstream obsproject/obs-studio#13905). The fork fix,
obs-rust/obs-websocket#18 (a port of obsproject/obs-websocket#1355),
reports those items with empty strings and came in with the submodule
bump in obs-rust#1996.

test_ws_list_property_items compiles the plugin's ArrayHelper against
libobs and builds list properties with a NULL value and a NULL name. It
needs no libobs startup and no display. With the submodule at 0d663ee,
the commit before the fix, both NULL cases fail (the helper throws);
at the current pin all 3 cases pass.

The fix gets its line in docs/features.md.

Fixes obs-rust#1266
@rdoupe
rdoupe requested a review from zackees as a code owner October 24, 2026 22:11
@zackees
zackees enabled auto-merge October 24, 2026 22:11
@zackees
zackees added this pull request to the merge queue Oct 24, 2026
Merged via the queue into obs-rust:master with commit d14d493 Oct 24, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: obs-websocket: GetInputPropertiesListPropertyItems aborts OBS on a list item with no name or value (upstream #13905)

2 participants