Skip to content

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

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.)

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

    bufferIssues and PRs related to the buffer subsystem.docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions