Skip to content

media-playback: Fix null pointer dereference #12291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

howellrl
Copy link
Contributor

@howellrl howellrl commented Jun 16, 2025

Description

Move channels value assignment below mp_media_can_play_frame check.

Motivation and Context

Channels value was being assigned before mp_media_can_play_frame check occurred resulting in a null pointer de-reference exception. This fixes media source crashing issue - fixes #11851.

How Has This Been Tested?

Tested by following recreation steps using attached file and observing OBS crash. Made code change and re-ran test following same recreation steps. No crash was observed after fix.

OS Version: Windows 11

Channels variable was not used in function before mp_media_can_play_frame check, moving to after the check should not affect any other areas of code.

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.
  • I have included updates to all appropriate documentation.

@notr1ch
Copy link
Member

notr1ch commented Jun 16, 2025

This sounds oddly familiar... looks like a regression caused by what should have been a non-functional change.

I think we need to remove that assignment at the top completely if this is causing programmer confusion.

@howellrl
Copy link
Contributor Author

Should I remove the channels assignment and pass f->ch_layout.nb_channels directly into convert_speaker_layout?

@howellrl
Copy link
Contributor Author

I adjusted my fix to remove the channels assignment and instead pass the f->ch_layout.nb_channels directly into convert_speaker_layout.

@RytoEX RytoEX requested a review from notr1ch June 17, 2025 18:04
@RytoEX RytoEX self-assigned this Jun 17, 2025
@RytoEX RytoEX added the Bug Fix Non-breaking change which fixes an issue label Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix Non-breaking change which fixes an issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Media source crashing on OBS v29 and later
5 participants