Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Don't access buffer data before initializing it.
Browse files Browse the repository at this point in the history
Prevents valgrind from complaining and still tests that buffer data is
treated as unsigned.
  • Loading branch information
thughes authored and ry committed Dec 22, 2010
1 parent a4c5353 commit ea3b78c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/simple/test-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ var b = Buffer(1024); // safe constructor
console.log("b.length == " + b.length);
assert.strictEqual(1024, b.length);

b[0] = -1;
assert.equal(b[0], 255);

for (var i = 0; i < 1024; i++) {
assert.ok(b[i] >= 0);
b[i] = i % 256;
}

Expand Down

0 comments on commit ea3b78c

Please sign in to comment.