mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
test: fix valgrind uninitialized memory warning
parallel/test-buffer called `Buffer.prototype.toString()` on a buffer with uninitialized memory. Call `Buffer.prototype.fill()` on it first. PR-URL: https://github.com/nodejs/io.js/pull/2193 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
parent
8fd3ce100e
commit
ac70bc8240
@ -802,7 +802,9 @@ assert.equal(buf[4], 0);
|
||||
|
||||
// Check for fractional length args, junk length args, etc.
|
||||
// https://github.com/joyent/node/issues/1758
|
||||
Buffer(3.3).toString(); // throws bad argument error in commit 43cb4ec
|
||||
|
||||
// Call .fill() first, stops valgrind warning about uninitialized memory reads.
|
||||
Buffer(3.3).fill().toString(); // throws bad argument error in commit 43cb4ec
|
||||
assert.equal(Buffer(-1).length, 0);
|
||||
assert.equal(Buffer(NaN).length, 0);
|
||||
assert.equal(Buffer(3.3).length, 3);
|
||||
|
Loading…
Reference in New Issue
Block a user