Skip to content

Commit

Permalink
test: fix typos in read-buffer tests
Browse files Browse the repository at this point in the history
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: #16834
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
jimivdw authored and MylesBorins committed Nov 16, 2017
1 parent 60c918a commit b166b6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/parallel/test-buffer-read.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b166b6b

Please sign in to comment.