From d7da2920639377ad141e387c4e156000553adaee Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Tue, 5 Jan 2016 13:11:49 +1100 Subject: [PATCH] script_number: initialize result to 0 --- src/script_number.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script_number.js b/src/script_number.js index 5177a8c..2c1a0ce 100644 --- a/src/script_number.js +++ b/src/script_number.js @@ -11,8 +11,6 @@ function decode (buffer, maxLength, minimal) { } } - var result - // 40-bit if (length === 5) { var a = buffer.readUInt32LE(0) @@ -22,6 +20,8 @@ function decode (buffer, maxLength, minimal) { return b * 0x100000000 + a } + var result = 0 + // 32-bit / 24-bit / 16-bit / 8-bit for (var i = 0; i < length; ++i) { result |= buffer[i] << (8 * i)