Skip to content

Commit

Permalink
test: fix allocUnsafe uninitialized buffer check
Browse files Browse the repository at this point in the history
Fixes parallel/test-buffer-bindingobj-no-zerofill to properly check
that buffers created with `Buffer.allocUnsafe()` are not zero-filled.

The test introduced in #11706 passes even if the buffer has been
zero-filled and fails if none of the buffer values are zero.

Refs: #11706
PR-URL: #12290
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Qantas94Heavy authored and evanlucas committed May 2, 2017
1 parent 71b39ae commit 1ab998f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-bindingobj-no-zerofill.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const monkeyPatchedBuffer = require('../../lib/buffer');
// possible that a segment of memory is already zeroed out, so try again and
// again until we succeed or we time out.
let uninitialized = buffer.Buffer.allocUnsafe(1024);
while (uninitialized.some((val) => val !== 0))
while (uninitialized.every((val) => val === 0))
uninitialized = buffer.Buffer.allocUnsafe(1024);

// On monkeypatched buffer, zeroFill property is undefined. allocUnsafe() should
Expand Down

0 comments on commit 1ab998f

Please sign in to comment.