0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

test: fix typos in read-buffer tests

The offset-exceeding tests for readFloat contained a double test
for readFloatLE instead of one for readFloatLE and one for
readFloatBE. This is fixed in this commit.

PR-URL: https://github.com/nodejs/node/pull/16834
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Jimi van der Woning 2017-11-06 17:36:56 +01:00 committed by Rich Trott
parent 13e983bf83
commit 48a777287d

View File

@ -59,13 +59,13 @@ read(buf, 'readUIntBE', [2, 0], 0xfd);
read(buf, 'readUIntLE', [2, 0], 0x48);
// attempt to overflow buffers, similar to previous bug in array buffers
assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(0xffffffff),
assert.throws(() => Buffer.allocUnsafe(8).readFloatBE(0xffffffff),
RangeError);
assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(0xffffffff),
RangeError);
// ensure negative values can't get past offset
assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(-1), RangeError);
assert.throws(() => Buffer.allocUnsafe(8).readFloatBE(-1), RangeError);
assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(-1), RangeError);
// offset checks