From ce9dee9370173c76784100bd2b7c08ced76143d2 Mon Sep 17 00:00:00 2001 From: Tom James Holub Date: Sat, 22 Jul 2017 09:26:30 -0700 Subject: [PATCH] util.readNumber: stop overflowing until full range of uint32 | #497 --- src/util.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/util.js b/src/util.js index 78394ad4..f2d8bdef 100644 --- a/src/util.js +++ b/src/util.js @@ -85,12 +85,9 @@ export default { readNumber: function (bytes) { var n = 0; - for (var i = 0; i < bytes.length; i++) { - n <<= 8; - n += bytes[i]; + n += Math.pow(256, i) * bytes[bytes.length - 1 - i]; } - return n; },