This commit is contained in:
Christopher Jeffrey 2016-03-25 16:32:15 -07:00
parent adb95e2a3a
commit a52d62a71e

View File

@ -1450,16 +1450,10 @@ utils.readVarint = function readVarint(arr, off) {
r = utils.readU32(arr, off + 1); r = utils.readU32(arr, off + 1);
bytes = 5; bytes = 5;
} else if (arr[off] === 0xff) { } else if (arr[off] === 0xff) {
try { r = utils.readU64N(arr, off + 1);
r = utils.readU64(arr, off + 1).toNumber();
} catch (e) {
r = 0;
}
bytes = 9; bytes = 9;
} else { } else {
// Malformed assert(false, 'Malformed varint.');
r = arr[off];
bytes = 1;
} }
return { off: off + bytes, r: r }; return { off: off + bytes, r: r };
@ -1501,7 +1495,8 @@ utils.writeVarint = function writeVarint(dst, num, off) {
} }
dst[off] = 0xff; dst[off] = 0xff;
utils.writeU64(dst, num, off + 1); utils.writeU64N(dst, num, off + 1);
return 9; return 9;
}; };