From caf80d442b57590e778398682fa602630d4b35d3 Mon Sep 17 00:00:00 2001 From: Wei Han Date: Thu, 2 Mar 2023 10:31:21 -0800 Subject: [PATCH] Fix crash from setProperty in RCTTurboModule Summary: Changelog[Internal]: [iOS][Fixed] - Fix crash from calling setProperty in RCTTurboModule The crash is caused by passing a utf8 encoded string to a Object::setProperty overload which only allows ascii inputs. Reviewed By: RSNara Differential Revision: D43705999 fbshipit-source-id: b3f1b3fd27d43d40fe0a170d4c2e60faecc26dad --- .../core/platform/ios/ReactCommon/RCTTurboModule.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm b/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm index 85fb5ad459c..e56672ad0dd 100644 --- a/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +++ b/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm @@ -59,7 +59,7 @@ static jsi::Object convertNSDictionaryToJSIObject(jsi::Runtime &runtime, NSDicti { jsi::Object result = jsi::Object(runtime); for (NSString *k in value) { - result.setProperty(runtime, [k UTF8String], convertObjCObjectToJSIValue(runtime, value[k])); + result.setProperty(runtime, convertNSStringToJSIString(runtime, k), convertObjCObjectToJSIValue(runtime, value[k])); } return result; }