Skip to content

Documentation: Unclear if Buffer buf[i] is bounds-checked #11244

Closed
@joliss

Description

@joliss

From the buf[i] documentation for Buffer, it's unclear whether the following code produces undefined behavior due to out-of-bounds access or does nothing:

new Buffer('')[1000] = 42

I think this should be documented.

(I assume it's bounds-checked since console.log(new Buffer('')[1000]) prints undefined rather than 0, but I haven't checked the source.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bufferIssues and PRs related to the buffer subsystem.docIssues and PRs related to the documentations.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions