Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(perf): avoid unsafe NSProxy delegate ivar lookup - #16270

#16270
Merged
JesusRojass merged 1 commit into
firebase:mainfirebase/firebase-ios-sdk:mainfrom
aybarska:performance/proxy-delegate-crashaybarska/firebase-ios-sdk:performance/proxy-delegate-crashCopy head branch name to clipboard
Jun 15, 2026
Merged

fix(perf): avoid unsafe NSProxy delegate ivar lookup#16270
JesusRojass merged 1 commit into
firebase:mainfirebase/firebase-ios-sdk:mainfrom
aybarska:performance/proxy-delegate-crashaybarska/firebase-ios-sdk:performance/proxy-delegate-crashCopy head branch name to clipboard

Conversation

@aybarska

Copy link
Copy Markdown
Contributor

Discussion

Fixes #16254.

Firebase Performance unwraps NSProxy NSURLSession delegates so it can instrument the wrapped delegate. That lookup previously used generic ivar scanning, which can consult -class. Some NSProxy implementations forward -class to the wrapped object, so the ivar list can come from a class that does not match the proxy runtime layout.

This change uses the proxy object runtime class when scanning ivars, avoiding forwarded -class and preserving the existing NSProxy delegate instrumentation behavior.

Testing

  • FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT=1 xcodebuild -scheme PerformanceUnit -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' -skipPackageUpdates build

@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@google-cla

google-cla Bot commented Jun 12, 2026

Copy link
Copy Markdown

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.

@JesusRojass

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a crash in Firebase Performance when instrumenting NSProxy NSURLSession delegates that report a wrapped object's class. It replaces the usage of [GULSwizzler ivarObjectsForObject:] with a custom helper FPRIvarObjectsForProxy that retrieves the runtime class using object_getClass instead of -class. A unit test has been added to verify this fix. Feedback was provided to defensively initialize count to 0 and check if ivars is not NULL before iterating or freeing to avoid potential undefined behavior.

Comment thread FirebasePerformance/Sources/Instrumentation/FPRProxyObjectHelper.m Outdated

@JesusRojass JesusRojass 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.

LGMT
Applying the gemini suggestion would be neat

@aybarska Have you tested this against your repro?

@aybarska
aybarska force-pushed the performance/proxy-delegate-crash branch from 7a7b497 to f0d80c6 Compare June 15, 2026 07:15
@aybarska

Copy link
Copy Markdown
Contributor Author

@JesusRojass thx, gemini solution applied

Yes, I tested it against the repro and the crash no longer occurs

@JesusRojass JesusRojass 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.

LGTM! Waiting on checks to be done to merge

@JesusRojass
JesusRojass merged commit b1df9f0 into firebase:main Jun 15, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EXC_BAD_ACCESS crash in +[GULSwizzler ivarObjectsForObject:] when Pangle SDK opens NSURLSession (Firebase Performance Instrumentation conflict)

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.