Skip to content

createNativeArrayBuffer accepts invalid allocation sizes #1545

Description

@OskarEichler

Description

createNativeArrayBuffer(double) casts its JavaScript number directly to size_t. Negative, non-finite, and values beyond the platform size limit can therefore become huge allocations or enter an out-of-range floating-to-integer conversion.

Reproduction

Call NitroModules.createNativeArrayBuffer(-1), Infinity, or Number.MAX_VALUE. Current native code reaches the unchecked allocation path.

Expected behavior

Invalid sizes should reject deterministically before conversion or allocation.

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