Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

ArrayBuffer.prototype.resize - detached buffer handling? #116

@phoddie

Description

@phoddie

The argument to resize can cause user-code to execute. That code could call transfer, detaching the buffer. The algorithm steps don't check for [[IsDetachedBuffer]] after coercing the argument in Step 5:

  1. If IsDetachedBuffer(O) is true, throw a TypeError exception.
  2. Let newByteLength be ? ToIntegerOrInfinity(newLength).
  3. If newByteLength < 0 or newByteLength > O.[[ArrayBufferMaxByteLength]], throw a RangeError exception.
  4. Let hostHandled be ? HostResizeArrayBuffer(O, newByteLength).

This turned up as a crash in testing the implementation in XS. One solution is to repeat Step 4 after Step 6. Whatever the solution, it should probably be normatively defined so engines behave consistently.

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