From: Volker Mische Date: Fri, 19 Jan 2018 14:47:45 +0000 (+0100) Subject: Out of bounds error message changed X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=cb989717b825117ee9ae6e4f33c215b5007ac4cc;p=buffer.git Out of bounds error message changed --- diff --git a/index.js b/index.js index 01977be..9481755 100644 --- a/index.js +++ b/index.js @@ -217,7 +217,7 @@ function fromArrayLike (array) { function fromArrayBuffer (array, byteOffset, length) { if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('\'offset\' is out of bounds') + throw new RangeError('"offset" is outside of buffer bounds') } if (array.byteLength < byteOffset + (length || 0)) { diff --git a/test/node/test-buffer-alloc.js b/test/node/test-buffer-alloc.js index 0bd87a3..597fa93 100644 --- a/test/node/test-buffer-alloc.js +++ b/test/node/test-buffer-alloc.js @@ -967,7 +967,7 @@ assert.strictEqual(SlowBuffer.prototype.offset, undefined); assert.doesNotThrow(() => Buffer.from('abc')); } -/* + // Test that ParseArrayIndex handles full uint32 { var errMsg = common.expectsError({ @@ -977,7 +977,7 @@ assert.strictEqual(SlowBuffer.prototype.offset, undefined); }); assert.throws(() => Buffer.from(new ArrayBuffer(0), -1 >>> 0), errMsg); } - +/* // ParseArrayIndex() should reject values that don't fit in a 32 bits size_t. common.expectsError(() => { var a = Buffer.alloc(1);