Skip to content

Generated numeric enum conversion accepts invalid JavaScript values #1567

Description

@OskarEichler

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions