Skip to content

utils: Report list items without a name or value as empty strings - #18

Merged
zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:fix/list-item-null
Oct 20, 2026
Merged

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

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

GetInputPropertiesListPropertyItems put the name and string value of every list item straight into json (Utils::Obs::ArrayHelper::GetListPropertyItems(), src/utils/Obs_ArrayHelper.cpp lines 270 and 277). libobs keeps items as they were added, so an item with a NULL name or NULL string value made json throw std::logic_error ("basic_string: construction from null is not valid") on the websocket thread, and OBS aborted. The macOS Screen Capture source adds a placeholder with a NULL value at the top of its display and application lists, so the request crashed OBS every time for those properties (upstream obsproject/obs-studio#13905, reported by sgaldeano).

A NULL name or value is now reported as an empty string, which is also what the properties dialog stores when such an entry is picked. Items with a name and value are reported as before.

Port of obsproject/obs-websocket#1355 by xiaoshao9704 (co-author on the commit).

Tested in obs-rust/obs-studio with test_ws_list_property_items, which compiles this ArrayHelper against libobs: 2 of 3 cases fail at 0d663ee (an item with a NULL value, an item with a NULL name) and 3 of 3 pass with the fix, in both libobs lanes. Also in a full OBS build (frontend + obs-websocket) in both lanes, and end to end: with an input that has such items, the release v0.1.0-beta.20261014 and current master abort on the request; builds with this branch answer with empty strings.

Refs obs-rust/obs-studio#1266. The obs-rust/obs-studio PR that moves the submodule to this branch carries the regression test and closes the issue.

🤖 Generated with Claude Code

GetInputPropertiesListPropertyItems put the name and string value of
every list item straight into json. libobs keeps items as they were
added, so an item with a NULL name or NULL string value made json throw
std::logic_error ("basic_string: construction from null is not valid")
on the websocket thread, and OBS aborted. The macOS Screen Capture
source adds a placeholder with a NULL value at the top of its display
and application lists, so the request crashed OBS every time for those
properties (upstream obsproject/obs-studio#13905, reported by
sgaldeano).

A NULL name or value is now reported as an empty string, which is also
what the properties dialog stores when such an entry is picked. Items
with a name and value are reported as before.

Port of obsproject/obs-websocket#1355 by xiaoshao9704.

Refs obs-rust/obs-studio#1266.

Co-Authored-By: XiaoShao <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

@zackees zackees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review. The change itself is correct and minimal: a NULL list-item name or string value becomes "" instead of throwing std::logic_error out of nlohmann::json, and the int/float paths are untouched.

Policy flag for @zackees: obs-studio's AGENTS.md ("OBS WebSocket compatibility directive") keeps the C++ plugin as an unmodified compatibility check, and says not to modify it to accommodate Rust OBS. This fixes a crash that also happens upstream with C libobs, so it is not an accommodation, but it is still a change to the plugin and needs the maintainer's explicit OK before merging.

@zackees
zackees merged commit a4df0f3 into obs-rust:master Oct 20, 2026
1 check passed
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 23, 2026
…bs-rust#1996)

* plugins/obs-websocket: bump to notify the parallel batch waiter under the lock

Bumps the submodule from 0d663eefb to 99dd8468b, which brings in:
- obs-rust/obs-websocket#18: list items without a name or value report empty strings (obs-rust#1266)
- obs-rust/obs-websocket#19: GetStats CPU usage is measured per session
- 99dd8468b: a parallel RequestBatch notifies its waiter while holding the
  lock, so the waiter cannot return and free the shared batch state while
  the last task is still notifying (the intermittent test_ws_batch_order
  SIGSEGV on macOS Tier 2).

* docs: record the parallel RequestBatch crash fix in the features ledger
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 24, 2026
…ust#2251)

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
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.

2 participants