encoding: minor.

This commit is contained in:
Christopher Jeffrey 2017-09-05 09:41:02 -07:00
parent 4046202b3f
commit 83178e9333
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -665,13 +665,13 @@ encoding.readVarintN = function readVarintN(data, off) {
const size = 9; const size = 9;
assert(off + size <= data.length, off); assert(off + size <= data.length, off);
const value = encoding.readU64N(data, off + 1); const value = encoding.readU64N(data, off + 1);
enforce(value.gtn(0xffffffff), off, 'Non-canonical varint'); enforce(value.hi !== 0, off, 'Non-canonical varint');
return new Varint(size, value); return new Varint(size, value);
} }
const result = encoding.readVarint(data, off); const {size, value} = encoding.readVarint(data, off);
result.value = U64.fromInt(result.value);
return result; return new Varint(size, U64.fromInt(value));
}; };
/** /**