Merge pull request #7098 from Snuffleupagus/uint32-checksums

Ensure that TrueType font tables have `uint32` checksums
This commit is contained in:
Yury Delendik 2016-03-22 14:11:27 -05:00
commit 4a44a2c7dc

View File

@ -403,9 +403,8 @@ var OpenTypeFileBuilder = (function OpenTypeFileBuilderClosure() {
// checksum
var checksum = 0;
for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
var quad = (file[j] << 24) + (file[j + 1] << 16) +
(file[j + 2] << 8) + file[j + 3];
checksum = (checksum + quad) | 0;
var quad = readUint32(file, j);
checksum = (checksum + quad) >>> 0;
}
writeInt32(file, offset + 4, checksum);
@ -1246,7 +1245,7 @@ var Font = (function FontClosure() {
function readTableEntry(file) {
var tag = bytesToString(file.getBytes(4));
var checksum = file.getInt32();
var checksum = file.getInt32() >>> 0;
var offset = file.getInt32() >>> 0;
var length = file.getInt32() >>> 0;