Skip to content

Commit ac70bc8

Browse files
committed
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: #2193 Reviewed-By: Trevor Norris <[email protected]>
1 parent 8fd3ce1 commit ac70bc8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/parallel/test-buffer.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,9 @@ assert.equal(buf[4], 0);
802802

803803
// Check for fractional length args, junk length args, etc.
804804
// https://github.com/joyent/node/issues/1758
805-
Buffer(3.3).toString(); // throws bad argument error in commit 43cb4ec
805+
806+
// Call .fill() first, stops valgrind warning about uninitialized memory reads.
807+
Buffer(3.3).fill().toString(); // throws bad argument error in commit 43cb4ec
806808
assert.equal(Buffer(-1).length, 0);
807809
assert.equal(Buffer(NaN).length, 0);
808810
assert.equal(Buffer(3.3).length, 3);

0 commit comments

Comments
 (0)