Description
Nitrogen generates a canConvert() validator for numeric enums, but direct generated fromJSI() conversion never calls it. Direct enum properties therefore accept undeclared, fractional, and non-finite JavaScript numbers and cast them to the closed C++ enum. The validator also casts non-finite and out-of-range doubles to int before it can reject them.
Expected behavior
Generated direct enum conversion should reject every value that is not one of the declared integer members, and validation should reject unsafe numbers before converting them to int.
Description
Nitrogen generates a
canConvert()validator for numeric enums, but direct generatedfromJSI()conversion never calls it. Direct enum properties therefore accept undeclared, fractional, and non-finite JavaScript numbers and cast them to the closed C++ enum. The validator also casts non-finite and out-of-range doubles tointbefore it can reject them.Expected behavior
Generated direct enum conversion should reject every value that is not one of the declared integer members, and validation should reject unsafe numbers before converting them to
int.