Skip to content

fix(auth,apple): prevent EXC_BAD_ACCESS crash in Apple Sign-In completion handler #17273

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

Merged
merged 1 commit into from
May 2, 2025

Conversation

lukemmtt
Copy link
Contributor

@lukemmtt lukemmtt commented Apr 12, 2025

Fixes a crash where Firebase Auth's Apple Sign-In handler crashes with EXC_BAD_ACCESS on iOS/macOS when the completion handler is deallocated during async operations.

Specifically:

  • Captures appleCompletion locally within handleSignInWithApple to prevent deallocation
  • Adds nil check before calling the completion handler
  • Creates strong references for callbacks in async operations

Affects both iOS and macOS platforms through the shared implementation.

Closes #17216.

Copy link

google-cla bot commented Apr 12, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

…tion handler

- Locally captures completion handler to prevent deallocation
- Fixes crash during async Apple Sign-In operations
@lukemmtt lukemmtt force-pushed the apple-sign-in-fix branch from 673e3e5 to 7ab5067 Compare April 12, 2025 19:15
@lukemmtt lukemmtt marked this pull request as ready for review April 12, 2025 19:16
Copy link
Contributor

@MichaelVerdon MichaelVerdon left a comment

Choose a reason for hiding this comment

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

Tested this locally, seems to work fine. Thank you for this 😄

@Lyokone
Copy link
Contributor

Lyokone commented May 2, 2025

Thanks for the fix, really appreciate it :)

@Lyokone Lyokone merged commit cc7d28a into firebase:main May 2, 2025
36 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[firebase_auth]: handleSignInWithApple EXC_BAD_ACCESS (KERN_INVALID_ADDRESS)
3 participants