Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update tests for larger Buffers
V8 is about to increase the max TypedArray length to 2**32-1, which
Node inherits as Buffer.kMaxLength. Some tests relied on values greater
than the previous max length (2**31-1) to throw errors; this updates
those tests for the new max length.
  • Loading branch information
jakobkummerow authored and mmarchini committed Mar 4, 2020
commit e9b7f477225c5842426635c3fda46c6cd6b0e5c8
4 changes: 2 additions & 2 deletions test/parallel/test-buffer-alloc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const SlowBuffer = require('buffer').SlowBuffer;
// Verify the maximum Uint8Array size. There is no concrete limit by spec. The
// internal limits should be updated if this fails.
assert.throws(
() => new Uint8Array(2 ** 31),
{ message: 'Invalid typed array length: 2147483648' }
() => new Uint8Array(2 ** 32),
{ message: 'Invalid typed array length: 4294967296' }
);

const b = Buffer.allocUnsafe(1024);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-over-max-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ assert.throws(() => Buffer.allocUnsafe(kMaxLength + 1), bufferMaxSizeMsg);
assert.throws(() => Buffer.allocUnsafeSlow(kMaxLength + 1), bufferMaxSizeMsg);

// issue GH-4331
assert.throws(() => Buffer.allocUnsafe(0xFFFFFFFF), bufferMaxSizeMsg);
assert.throws(() => Buffer.allocUnsafe(0x100000000), bufferMaxSizeMsg);
assert.throws(() => Buffer.allocUnsafe(0xFFFFFFFFF), bufferMaxSizeMsg);