joyent/node — pull request #7442 by Gnaphron (2014-04-09 23:55:06+00:00)
Title: Fix for UInt32 returning signed int

Read UInt32 on v0.11.13-pre returns a signed integer if the MSB of the the 3rd byte is 1:

example:
-- UInt32.js
var b = new Buffer([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])
var firstHalf = b.readUInt32BE(0);
console.log("ReadUIntBE32 (4294967295)" + firstHalf);

firstHalf = b.readUInt32LE(0);
console.log("ReadUIntLE32 (4294967295)" + firstHalf);

var firstHalf = b.readUInt16BE(0);
console.log("ReadUIntBE16 (4294967295)" + firstHalf);

firstHalf = b.readUInt16LE(0);
console.log("ReadUIntLE16 (4294967295)" + firstHalf);

--

./node --version
v0.11.13-pre

./node UInt32.js
ReadUIntBE32 (4294967295)-1
ReadUIntLE32 (4294967295)4294967295
ReadUIntBE16 (4294967295)65535
ReadUIntLE16 (4294967295)65535

./node --version
v0.10.15

./node UInt32.js
ReadUIntBE32 (4294967295)4294967295
ReadUIntLE32 (4294967295)4294967295
ReadUIntBE16 (4294967295)65535
ReadUIntLE16 (4294967295)65535