You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There were a few questions in the PR about whether we need to check the type of a value before getting a casted value. For example, in napi_get_value_int32 we check value->IsNumber(), then call value.As<v8::Int32>()->Value(). What if the value is a non-integer number? Does the As<> cast work, or crash, or what?
Basically we need to add a bunch of test cases for these kinds of conversions, and add necessary type checks to avoid crashes. In my opinion, the APIs should not crash when provided a napi_value that is valid but the wrong type.
The text was updated successfully, but these errors were encountered:
There were a few questions in the PR about whether we need to check the type of a value before getting a casted value. For example, in
napi_get_value_int32
we checkvalue->IsNumber()
, then callvalue.As<v8::Int32>()->Value()
. What if the value is a non-integer number? Does theAs<>
cast work, or crash, or what?Basically we need to add a bunch of test cases for these kinds of conversions, and add necessary type checks to avoid crashes. In my opinion, the APIs should not crash when provided a
napi_value
that is valid but the wrong type.The text was updated successfully, but these errors were encountered: