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: nodejs#16834
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
jimivdw authored and Trott committed Nov 6, 2017
1 parent 13e983b commit 48a7772
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 48a7772

Please sign in to comment.