In Node 6.3.1, you could do this:
var buff = Buffer.alloc(1);
buff.write('', 1, 0);
console.log(buff);
That is, writing empty strings out of the buffer bounds would not cause a crash. However, with 6.4, that code above causes a crash with this error message:
buffer.js:761
return this.utf8Write(string, offset, length);
Range Error: Offset is out of bounds
This change causes my library to break. I'm wondering if this was an intentional change. If so, just let me know, and I'll patch my library to check for empty strings before writing.
This seems like a real bug introduced by 46f40cfb4c3adb83d888202fa5dbc8a5e38fee2a, even if this is an edge case. On a first look, it seems like changing >= to > is the correct fix for this.
Ugh. Yep, confirmed. Need to add a regression test that covers this also.
Ran into the same issue with node-mysql2, glad it has been identified already.
The fix should land in the next day or two and will go out in the next patch release. Shouldn't take too long. In the meantime, you can apply the patch in #8154 to work around it.
Got hit by this as well. Hopefully v6.4.1 can be released soon!
@mathiasbynens Looks like it's fixed only on master, not backported to v6.x (yet?).
I've been working on getting the commits cherry-picked over to v6.x. Hopefully, will be able to get a release proposal up soon
Most helpful comment
The fix should land in the next day or two and will go out in the next patch release. Shouldn't take too long. In the meantime, you can apply the patch in #8154 to work around it.