Skip to content

Commit bd64ba6

Browse files
authored
Fix the handling of Unicode characters in log and assertion messages (#8372)
Currently, any UTF-8 characters outside the ascii set may be encoded incorrectly.
1 parent d50dd0a commit bd64ba6

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Firestore/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v8.4.0
2+
- [fixed] Fixed handling of Unicode characters in log and assertion messages
3+
(#8372).
4+
15
# v8.2.0
26
- [changed] Passing in an empty document ID, collection group ID, or collection
37
path will now result in a more readable error (#8218).

Firestore/core/src/util/exception_apple.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ ABSL_ATTRIBUTE_NORETURN void ObjcThrowHandler(ExceptionType type,
6060
handleFailureInFunction:MakeNSString(func)
6161
file:MakeNSString(file)
6262
lineNumber:line
63-
description:@"%@: %s", ExceptionName(type),
64-
message.c_str()];
63+
description:@"%@: %@", ExceptionName(type),
64+
MakeNSString(message)];
6565
std::terminate();
6666
} else {
6767
@throw MakeException(type, message); // NOLINT

Firestore/core/src/util/log_apple.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ bool LogIsLoggable(LogLevel level) {
8585
}
8686

8787
void LogMessage(LogLevel level, const std::string& message) {
88-
LogMessageV(level, @"%s", message.c_str());
88+
LogMessageV(level, @"%@", MakeNSString(message));
8989
}
9090

9191
} // namespace util

0 commit comments

Comments
 (0)