Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Bogus length validation in Array.prototype.toSpliced #94

@linusg

Description

@linusg

Array.prototype.toSpliced does this:

12. If newLen > 2^53 - 1, throw a TypeError exception.
13. Let A be ? ArrayCreate(𝔽(newLen)).

But ArrayCreate does this:

1. If length > 2^32 - 1, throw a RangeError exception.

Couple of issues:

  • Why is the length validated to be in a range much larger than the immediate next step allows in the first place?
  • Why TypeError and not RangeError - this seems to be inherited from Array.prototype.splice, which uses ArraySpeciesCreate and only passes actualDeleteCount as the length in the next step however
  • Is it intentional that depending on how much too large (i.e. above 2^32 - 1) the value is you'll get a different error type?

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