Skip to content

mac-capture: Don't read channels if uninitialized - #14108

Open
ayushkrsingh946 wants to merge 1 commit into
obsproject:masterfrom
ayushkrsingh946:fix-coreaudio-crash-disconnected-device
Open

ayushkrsingh946 wants to merge 1 commit into
obsproject:masterfrom
ayushkrsingh946:fix-coreaudio-crash-disconnected-device

Conversation

@ayushkrsingh946

Copy link
Copy Markdown

Description

When getting CoreAudio properties or handling property changes for an audio device source on macOS, ensure the audio unit is initialized before attempting to query and display output channels. Also reset available_channels and guard channel_names access against null pointer dereferences when a device is disconnected.

Motivation and Context

Fixes #14105

When an audio input capture source points to a disconnected device, closing the properties dialog causes OBS to crash with EXC_BAD_ACCESS (SIGSEGV at 0x0000000000000000).

In PR #11477, coreaudio_properties was guarded with ca->au_initialized, but the property modification callbacks coreaudio_device_changed and coreaudio_downmix_changed still called ensure_output_channels_visible without checking ca->au_initialized. Furthermore, when a device is uninitialized/disconnected, ca->channel_names is freed and set to NULL, but ca->available_channels was not reset to 0. When ensure_output_channel_prop subsequently invoked coreaudio_fill_combo_with_inputs, output_channel < ca->available_channels evaluated to true and attempted to index ca->channel_names, dereferencing NULL.

How Has This Been Tested?

Verified against crash log telemetry in #14105. Ensured all channel-reading code paths check ca->au_initialized and guard ca->channel_names.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
Guard channel configuration in coreaudio_device_changed and
coreaudio_downmix_changed to ensure the device is initialized. Also
reset available_channels on uninit and guard channel_names access
against null pointer dereferences when a device is disconnected.

Fixes obsproject#14105
@WizardCM WizardCM added kind/bug Categorizes issue or PR as related to a bug. platform/macos Categorizes issue or PR as affecting macOS specifically labels Oct 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. platform/macos Categorizes issue or PR as affecting macOS specifically

2 participants