diff --git a/lib/buffer.js b/lib/buffer.js index adb551a9e4e..ed159158415 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -66,7 +66,7 @@ function Buffer(subject, encoding) { 'size: 0x' + kMaxLength.toString(16) + ' bytes'); } - this.parent = null; + this.parent = undefined; if (this.length <= (Buffer.poolSize >>> 1) && this.length > 0) { if (this.length > poolSize - poolOffset) createPool(); @@ -118,7 +118,9 @@ function SlowBuffer(length) { // Objects created in C++. Significantly faster than calling the Buffer // function. function NativeBuffer(length) { - this.length = length; + this.length = length >>> 0; + // Set this to keep the object map the same. + this.parent = undefined; } NativeBuffer.prototype = Buffer.prototype;