mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
buffer: let WriteFloatGeneric silently drop values
Documentation currently states that setting noAssert and passing a value larger than can fit in the Buffer will cause data to be silently dropped. Change implementation to match documented behavior. Fixes: https://github.com/nodejs/node/issues/3766 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
1 parent
04d8a654b2
commit
edcb6c0603
2 files changed
+12
-3
No files matched your search
@@ -44,3 +44,10 @@ assert.throws(function() {
|
||||
AB.prototype.__proto__ = ArrayBuffer.prototype;
|
||||
new Buffer(new AB());
|
||||
}, TypeError);
|
||||
|
||||
// write{Double,Float}{LE,BE} with noAssert should not crash, cf. #3766
|
||||
var b = new Buffer(1);
|
||||
b.writeFloatLE(11.11, 0, true);
|
||||
b.writeFloatBE(11.11, 0, true);
|
||||
b.writeDoubleLE(11.11, 0, true);
|
||||
b.writeDoubleBE(11.11, 0, true);
|
||||
Reference in new issue
Block a user