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

Incorrect Buffer constructor behavior in v0.11.6 #6111

@RReverser

Description

@RReverser

It was always possible to create Buffer from any array-like object using http://nodejs.org/docs/v0.11.6/api/buffer.html#buffer_new_buffer_array and much code expects that behavior. In general, this technique still works, but not for new Buffer(anotherBufferInstance, ...args...) call - such call corrupts data in both original and resulting buffers.
Of course, I can workaround it in my code by checking instance of source data and using slice method specially for Buffer, but that looks like a serious bug that can cause data corruption in other projects as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions