Skip to content

Commit 33a26bc

Browse files
TrottDavenportEmma
authored andcommitted
fixup! test: remove buffer overflow test
1 parent 52b6882 commit 33a26bc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/parallel/test-buffer-fill.js

+15
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const common = require('../common');
44
const assert = require('assert');
55
const { codes: { ERR_OUT_OF_RANGE } } = require('internal/errors');
6+
const { internalBinding } = require('internal/test/binding');
67
const SIZE = 28;
78

89
const buf1 = Buffer.allocUnsafe(SIZE);
@@ -324,6 +325,13 @@ Buffer.alloc(8, '');
324325
assert.strictEqual(buf.toString(), 'էէէէէ');
325326
}
326327

328+
// Testing process.binding. Make sure "start" is properly checked for range
329+
// errors.
330+
assert.throws(
331+
() => { internalBinding('buffer').fill(Buffer.alloc(1), 1, -1, 0, 1); },
332+
{ code: 'ERR_OUT_OF_RANGE' }
333+
);
334+
327335
// Make sure "end" is properly checked, even if it's magically mangled using
328336
// Symbol.toPrimitive.
329337
{
@@ -341,6 +349,13 @@ Buffer.alloc(8, '');
341349
});
342350
}
343351

352+
// Testing process.binding. Make sure "end" is properly checked for range
353+
// errors.
354+
assert.throws(
355+
() => { internalBinding('buffer').fill(Buffer.alloc(1), 1, 1, -2, 1); },
356+
{ code: 'ERR_OUT_OF_RANGE' }
357+
);
358+
344359
// Test that bypassing 'length' won't cause an abort.
345360
assert.throws(() => {
346361
const buf = Buffer.from('w00t');

0 commit comments

Comments
 (0)