From d54259454047786091261341fe542e6502dc8215 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sat, 9 Jan 2016 15:26:39 +0100 Subject: [PATCH] detect more invalid arraybuffers --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 33f07b4..79c1198 100644 --- a/index.js +++ b/index.js @@ -183,9 +183,10 @@ function fromTypedArray (that, array) { } function fromArrayBuffer (that, array) { + array.byteLength // this throws if `array` is not a valid ArrayBuffer + if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance - array.byteLength that = new Uint8Array(array) that.__proto__ = Buffer.prototype } else { -- 2.34.1