mirror of https://github.com/nodejs/node.git
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>pull/2193/head
parent
8fd3ce100e
commit
ac70bc8240
|
@ -802,7 +802,9 @@ assert.equal(buf[4], 0);
|
||||||
|
|
||||||
// Check for fractional length args, junk length args, etc.
|
// Check for fractional length args, junk length args, etc.
|
||||||
// https://github.com/joyent/node/issues/1758
|
// 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(-1).length, 0);
|
||||||
assert.equal(Buffer(NaN).length, 0);
|
assert.equal(Buffer(NaN).length, 0);
|
||||||
assert.equal(Buffer(3.3).length, 3);
|
assert.equal(Buffer(3.3).length, 3);
|
||||||
|
|
Loading…
Reference in New Issue