-
- Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.
Description
The common Buffer implementation for writing integer values uses a rather opaque algorithm that involves carrying a -1 adjustment into high bytes when converting negative integers. The adjustment is improperly applied when lower bytes are zero.
An example:
> var buf = new Buffer(4); undefined > buf.writeInt32LE(-0x10000, 0); 4 > buf.toJSON().data [ 0, 0, 255, 255 ] > buf.writeIntLE(-0x10000, 0, 4); 4 > buf.toJSON().data [ 0, 255, 254, 255 ] This bug is present in v0.12.x through HEAD.
Patch incoming.
Metadata
Metadata
Assignees
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.