Skip to content

libobs: Return NULL from find_libobs_data_file without the libobs bundle (#2538) - #2540

Merged
zackees merged 1 commit into
masterfrom
fix/macos-libobs-bundle-nil
Oct 26, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/macos-libobs-bundle-nil

Conversation

@vpacher

@vpacher vpacher commented Oct 26, 2026

Copy link
Copy Markdown
Member

Fixes #2538

On macOS, find_libobs_data_file() (libobs/obs-cocoa.m.h) crashed when libobs is loaded from a libobs.framework without a bundle identifier (no Info.plist): the bundle is nil, the path string is nil, and strlen(NULL) follows. This is what crashes test_find_data_file in the macOS Rust Tier 2 stage Cargo [obs-c-reference] unchanged ctest suite, whose framework obs-build makes without an Info.plist. It blocks #2514 and every PR that selects that lane.

What changed

  • find_libobs_data_file() returns NULL when the bundle or its path is not found. obs_find_data_file() then searches the data paths from obs_add_data_path(), as on Linux and Windows. With the bundle present, nothing changes.
  • docs/features.md: a line under Fixed upstream bugs, Stability (upstream OBS has the same code).

RED → GREEN

  • RED: master's macOS Rust Tier 2 cargo stage (both runs of obs-graphics: Port the libnsgif state machine and public API (#2510) #2514: SIGSEGV in test_find_data_file), and locally (macOS 26.7.1) test_obs_core_info_characterization against a libobs.framework that has only Versions/A/libobs, no Info.plist: SIGSEGV.
  • GREEN, locally, 5 runs each: the framework without Info.plist 8/8 (the full data-path checks run there now); the CMake libobs-c-reference and hybrid frameworks 7 passed plus the macOS skip of test_find_data_file, as before.

A follow-up could give the cargo-built framework an Info.plist (stage_identity in rust/obs-build/src/platform/libobs_macos.rs), so that stage matches a real framework.

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: the RED is the existing test on master's macOS lane; one commit
  • User-visible change: line in docs/features.md
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes: not applicable
  • Intentional differences from C: not applicable (C change)

🤖 Generated with Claude Code

…dle (#2538)

On macOS, find_libobs_data_file() built the path from
[NSBundle bundleWithIdentifier:@"com.obsproject.libobs"]. When libobs is
loaded from a libobs.framework with no bundle identifier (no
Info.plist), the bundle is nil, the path string is nil and
strlen(libobsDataPath.UTF8String) is strlen(NULL): the first
obs_find_data_file() call crashed.

The macOS Rust Tier 2 stage "Cargo [obs-c-reference] unchanged ctest
suite" runs the cmocka tests against such a framework (obs-build makes
it without an Info.plist), so test_obs_core_info_characterization
(test_find_data_file) crashed there with SIGSEGV.

Now the function returns NULL when the bundle or its path is not found,
and obs_find_data_file() searches the data paths, as on Linux and
Windows. With the bundle present, nothing changes.

RED: master's macOS Rust Tier 2 cargo stage (two runs of #2514), and
locally test_obs_core_info_characterization against a libobs.framework
without Info.plist: SIGSEGV in test_find_data_file. GREEN: the same
framework 8/8; the CMake libobs-c-reference and hybrid frameworks 7/8
plus the macOS skip, as before (5 runs each).

Fixes #2538

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.

Reviewed: both nil checks (bundle, then the UTF-8 string) return NULL before strlen, and obs_find_data_file then falls through to the data paths, as on Linux and Windows. With the bundle present nothing changes. The RED is the crash on master's macOS lane (run 40410629662), and the ledger line is present. Queuing; I closed my skip-based #2539 in favour of this.

@zackees
zackees enabled auto-merge October 26, 2026 23:12
@zackees
zackees added this pull request to the merge queue Oct 26, 2026
Merged via the queue into master with commit 19565ad Oct 26, 2026
31 checks passed
@zackees
zackees deleted the fix/macos-libobs-bundle-nil branch October 26, 2026 23:48
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In review to Done in obs-rust Multiview Oct 27, 2026
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.

libobs: find_libobs_data_file crashes on macOS when the libobs bundle is not found

2 participants