aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Database/Persistence
diff options
context:
space:
mode:
authorGravatar Paul Beusterien <paulbeusterien@google.com>2018-06-25 10:49:10 -0700
committerGravatar GitHub <noreply@github.com>2018-06-25 10:49:10 -0700
commit16132541d439baa9a1f80bb2b9b004f7178cba4d (patch)
tree84401d4a1576a56b23e010936ba1195b3620b4f1 /Firebase/Database/Persistence
parent19e0c0bb6ab4e3fdbc72acf9bd967e1ffaa3866d (diff)
Fix undefined behavior sanitizer issues in RTDB (#1445)
Diffstat (limited to 'Firebase/Database/Persistence')
-rw-r--r--Firebase/Database/Persistence/FLevelDBStorageEngine.m4
1 files changed, 2 insertions, 2 deletions
diff --git a/Firebase/Database/Persistence/FLevelDBStorageEngine.m b/Firebase/Database/Persistence/FLevelDBStorageEngine.m
index e49d6bc..68254ad 100644
--- a/Firebase/Database/Persistence/FLevelDBStorageEngine.m
+++ b/Firebase/Database/Persistence/FLevelDBStorageEngine.m
@@ -672,7 +672,7 @@ static NSString* trackedQueryKeysKey(NSUInteger trackedQueryId, NSString *key) {
return [data subdataWithRange:NSMakeRange(1, data.length - 2)];
}
-- (id)fixDoubleParsing:(id)value {
+- (id)fixDoubleParsing:(id)value __attribute__((no_sanitize("float-cast-overflow"))) {
// The parser for double values in JSONSerialization at the root takes some short-cuts and delivers wrong results
// (wrong rounding) for some double values, including 2.47. Because we use the exact bytes for hashing on the server
// this will lead to hash mismatches. The parser of NSNumber seems to be more in line with what the server expects,
@@ -683,7 +683,7 @@ static NSString* trackedQueryKeysKey(NSUInteger trackedQueryId, NSString *key) {
// The NSJSON parser returns all numbers as double values, even those that contain no exponent. To
// make sure that the String conversion below doesn't unexpectedly reduce precision, we make sure that
// our number is indeed not an integer.
- if ((double)(long long)[value doubleValue] != [value doubleValue]) {
+ if ((double)(int64_t)[value doubleValue] != [value doubleValue]) {
NSString *doubleString = [value stringValue];
return [NSNumber numberWithDouble:[doubleString doubleValue]];
} else {