Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions FirebaseRemoteConfig/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Unreleased
- [fixed] Fix RCNConfigRealtime crash. (#14518)

# 11.9.0
- [fixed] Mark internal `fetchSession` property as `atomic` to prevent a concurrency
related crash. (#14449)
Expand Down
33 changes: 20 additions & 13 deletions FirebaseRemoteConfig/Sources/RCNConfigRealtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -573,20 +573,27 @@ - (void)URLSession:(NSURLSession *)session
return;
}

NSRange endRange = [strData rangeOfString:@"}"];
NSRange beginRange = [strData rangeOfString:@"{"];
if (beginRange.location != NSNotFound && endRange.location != NSNotFound) {
FIRLogDebug(kFIRLoggerRemoteConfig, @"I-RCN000015",
@"Received config update message on stream.");
NSRange msgRange =
NSMakeRange(beginRange.location, endRange.location - beginRange.location + 1);
strData = [strData substringWithRange:msgRange];
data = [strData dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *response = [NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingMutableContainers
error:&dataError];

[self evaluateStreamResponse:response error:dataError];
if (beginRange.location != NSNotFound) {
NSRange endRange =
[strData rangeOfString:@"}"
options:0
range:NSMakeRange(beginRange.location + 1,
strData.length - beginRange.location - 1)];
if (endRange.location != NSNotFound) {
FIRLogDebug(kFIRLoggerRemoteConfig, @"I-RCN000015",
@"Received config update message on stream.");
NSRange msgRange =
NSMakeRange(beginRange.location, endRange.location - beginRange.location + 1);
strData = [strData substringWithRange:msgRange];
data = [strData dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *response =
[NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingMutableContainers
error:&dataError];

[self evaluateStreamResponse:response error:dataError];
}
}
}

Expand Down
Loading