From 765c3d2b77bd6ac6d82b47020d670ab94f3f229d Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 2 Aug 2016 11:23:41 -0700 Subject: [PATCH] protobuf: fix safe int check. --- lib/bcoin/bip70/protobuf.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bcoin/bip70/protobuf.js b/lib/bcoin/bip70/protobuf.js index a077067a..29dac687 100644 --- a/lib/bcoin/bip70/protobuf.js +++ b/lib/bcoin/bip70/protobuf.js @@ -200,7 +200,6 @@ exports.readVarint = function readVarint(data, off) { break; } ch = data[off++]; - assert(size + 1 < 6, 'Number exceeds 2^53-1.'); // Optimization for javascript insanity. switch (size) { case 0: @@ -219,6 +218,8 @@ exports.readVarint = function readVarint(data, off) { size++; } + assert(utils.isSafeInteger(num), 'Number exceeds 2^53-1.'); + return { size: size, value: num }; };