mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 06:08:50 +02:00
buffer: allow .write() offset to be at buffer end
Do not throw if the offset passed to `buf.write()` points to the end of the buffer. Fixes: https://github.com/nodejs/node/issues/8127 PR-URL: https://github.com/nodejs/node/pull/8154 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
This commit is contained in:
parent
d6d3229603
commit
3242b27b54
2 changed files with 7 additions and 1 deletions
|
@ -358,6 +358,12 @@ writeTest.write('e', 3, 'ascii');
|
|||
writeTest.write('j', 4, 'ascii');
|
||||
assert.equal(writeTest.toString(), 'nodejs');
|
||||
|
||||
// Offset points to the end of the buffer
|
||||
// (see https://github.com/nodejs/node/issues/8127).
|
||||
assert.doesNotThrow(() => {
|
||||
Buffer.alloc(1).write('', 1, 0);
|
||||
});
|
||||
|
||||
// ASCII slice test
|
||||
{
|
||||
const asciiString = 'hello world';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue