!10274 fix the problem of napi_get_property interface which could access dead object

Merge pull request !10274 from shilei91/master
This commit is contained in:
openharmony_ci 2024-11-16 23:01:26 +00:00 committed by Gitee
commit 5f199ac319
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -821,10 +821,11 @@ JSTaggedValue ObjectFastOperator::FastGetPropertyByValue(JSThread *thread, JSTag
SCheckMode sCheckMode)
{
INTERPRETER_TRACE(thread, FastGetPropertyByValue);
JSHandle<JSTaggedValue> receiverHandler(thread, receiver);
JSHandle<JSTaggedValue> keyHandler(thread, key);
JSTaggedValue result = ObjectFastOperator::GetPropertyByValue(thread, receiver, key);
if (result.IsHole()) {
return JSTaggedValue::GetProperty(thread, JSHandle<JSTaggedValue>(thread, receiver),
JSHandle<JSTaggedValue>(thread, key), sCheckMode).GetValue().GetTaggedValue();
return JSTaggedValue::GetProperty(thread, receiverHandler, keyHandler, sCheckMode).GetValue().GetTaggedValue();
}
return result;
}