-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed
Description
- Version 13.1.0:
- Platform 64-bit Windows 10:
- Subsystem buffer:
The writeUIntBE()
method does not throw a Range Error if we pass a higher than allowed 48bit unsigned integer value
var buf = Buffer.alloc(6);
buf.writeUIntBE(281474976710655, 0, 6); // largest possible 48bit Unsigned Integer
console.log( buf.readUIntBE(0, 6) ); // -> 281474976710655 // written value returned
console.log( buf ); // -> <Buffer ff ff ff ff ff ff>
buf.writeUIntBE(281474976710656, 0, 6); // no [ERR_OUT_OF_RANGE] thrown
console.log( buf.readUIntBE(0, 6) ); // -> 0 // unexpected value returned
console.log( buf ); // -> <Buffer 00 00 00 00 00 00>
buf.writeUIntBE(3000000000000000, 0, 6); // no [ERR_OUT_OF_RANGE] thrown
console.log( buf.readUIntBE(0, 6) ); // -> 185250232893440 // unexpected value returned
console.log( buf ); // -> <Buffer a8 7b ee 53 80 00>
Metadata
Metadata
Assignees
Labels
No labels