mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Guard .asObject calls with .isObject check in JSIExecutor
Summary: When we call JSIExecutor::nativeCallSyncHook, we assume that the third argument is an object and call Value::asObject on it, before checking if the Object is an Array. Calling Value::asObject throws an error if the Value isn't an Object. This diff includes an isObject check on the third argument. Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D26735262 fbshipit-source-id: 96eb43d6c8bc1d78f3b5e0dc24ed6d419a446ecf
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5772c4947d
commit
3e1d7da9c1
@@ -439,7 +439,7 @@ Value JSIExecutor::nativeCallSyncHook(const Value *args, size_t count) {
|
||||
throw std::invalid_argument("nativeCallSyncHook arg count must be 3");
|
||||
}
|
||||
|
||||
if (!args[2].asObject(*runtime_).isArray(*runtime_)) {
|
||||
if (!args[2].isObject() || !args[2].asObject(*runtime_).isArray(*runtime_)) {
|
||||
throw std::invalid_argument(
|
||||
folly::to<std::string>("method parameters should be array"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user