Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer.prototype.write does not properly truncate at character boundaries #693

Open
natevw opened this issue Dec 30, 2014 · 0 comments
Open

Comments

@natevw
Copy link
Contributor

natevw commented Dec 30, 2014

A call to buf.write() should not write partial characters, whether limited by the target buffer length or explicit length parameter.

Code (explicit length case):

var b = Buffer(256);
b.fill(0);
var len = b.write("\u1234", 0, 2);
console.log(len, b.slice(0,3));

Expected:

0 <Buffer 00 00 00>

Actual:

2 <Buffer e1 88 00>

(There is a partial fix for the UTF-16 case in #692)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant