From 112c59ded120d21418024653de76b63798e1fd71 Mon Sep 17 00:00:00 2001 From: Gang Zhao Date: Mon, 19 Oct 2026 12:34:47 -0700 Subject: [PATCH] Fix: JSI Value::toString() should check the result type (#59146) Summary: Pull Request resolved: https://github.com/react/react-native/pull/59146 `global.String` could be overridden. We always need to check the return type before casting to `jsi::String`. Changelog: [Internal] Reviewed By: avp Differential Revision: D125707029 --- packages/react-native/ReactCommon/jsi/jsi/jsi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/jsi/jsi/jsi.cpp b/packages/react-native/ReactCommon/jsi/jsi/jsi.cpp index d09cc485cdea..521001a8980d 100644 --- a/packages/react-native/ReactCommon/jsi/jsi/jsi.cpp +++ b/packages/react-native/ReactCommon/jsi/jsi/jsi.cpp @@ -923,7 +923,7 @@ String Value::asString(IRuntime& rt) && { String Value::toString(IRuntime& runtime) const { Function toString = runtime.global().getPropertyAsFunction(runtime, "String"); - return toString.call(runtime, *this).getString(runtime); + return toString.call(runtime, *this).asString(runtime); } uint64_t BigInt::asUint64(IRuntime& runtime) const {