Skip to content
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

Fix RCNConfigRealtime crash. #14518

Merged
merged 6 commits into from
Mar 10, 2025
Merged

Fix RCNConfigRealtime crash. #14518

merged 6 commits into from
Mar 10, 2025

Conversation

tusharkhandelwal8
Copy link
Contributor

Crashlytics reports intermittent crashes in -[RCNConfigRealtime URLSession:dataTask:didReceiveData:] due to substring construction errors. The code assumes { and } delimiters within NSData from NSURLSession will always occur in order, leading to failures when this assumption is violated.

Error: RCNConfigRealtime crash "CFString cannot be created from a negative number of bytes"

Discussion Link: #14094

As a quick fix to avoid crashes, we will search for endRange.location from the index after beginRange.location, so that we can process the next valid JSON, even when chunk splits are improper.

As a long term fix, we are planning to include buffering logic, where we buffer the data until we receive complete JSON.

#Conflicts:
#	FirebaseRemoteConfig/CHANGELOG.md
@tusharkhandelwal8 tusharkhandelwal8 marked this pull request as ready for review March 3, 2025 13:13
Co-authored-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
@ncooke3 ncooke3 added this to the 11.10.0 - M161 milestone Mar 3, 2025
Copy link
Member

@paulb777 paulb777 left a comment

Choose a reason for hiding this comment

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

Thanks for addressing! Is it feasible to add a unit test?

#Conflicts:
#	FirebaseRemoteConfig/CHANGELOG.md
@tusharkhandelwal8 tusharkhandelwal8 merged commit 37a1a32 into main Mar 10, 2025
47 checks passed
@tusharkhandelwal8 tusharkhandelwal8 deleted the realtime-crash branch March 10, 2025 17:52
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.

4 participants