protobuf: fix safe int check.

This commit is contained in:
Christopher Jeffrey 2016-08-02 11:23:41 -07:00
parent 0b24daba31
commit 765c3d2b77
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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 };
};