Repository navigation
mac-capture: Don't read channels if uninitialized - #14108
Open
ayushkrsingh946 wants to merge 1 commit into
Open
ayushkrsingh946 wants to merge 1 commit into
ayushkrsingh946 wants to merge 1 commit into
Conversation
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
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_channelsand guardchannel_namesaccess 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 at0x0000000000000000).In PR #11477,
coreaudio_propertieswas guarded withca->au_initialized, but the property modification callbackscoreaudio_device_changedandcoreaudio_downmix_changedstill calledensure_output_channels_visiblewithout checkingca->au_initialized. Furthermore, when a device is uninitialized/disconnected,ca->channel_namesis freed and set toNULL, butca->available_channelswas not reset to 0. Whenensure_output_channel_propsubsequently invokedcoreaudio_fill_combo_with_inputs,output_channel < ca->available_channelsevaluated to true and attempted to indexca->channel_names, dereferencingNULL.How Has This Been Tested?
Verified against crash log telemetry in #14105. Ensured all channel-reading code paths check
ca->au_initializedand guardca->channel_names.Types of changes
Checklist: