bug 762484 - update OTS to upstream rev.92. r=emk

This commit is contained in:
Jonathan Kew 2012-06-07 17:00:13 +01:00
parent 83d944891a
commit 41b58b77bf
2 changed files with 14 additions and 9 deletions

View File

@ -1,6 +1,6 @@
This is the Sanitiser for OpenType project, from http://code.google.com/p/ots/.
Current revision: r91
Current revision: r92
Applied local patches:
ots-fix-vc10.patch - workaround for VS10 STL wrappers (bug 602558)

View File

@ -185,7 +185,9 @@ bool IsValidVersionTag(uint32_t tag) {
tag == Tag("typ1");
}
bool ProcessGeneric(ots::OpenTypeFile *header, ots::OTSStream *output,
bool ProcessGeneric(ots::OpenTypeFile *header,
uint32_t signature,
ots::OTSStream *output,
const uint8_t *data, size_t length,
const std::vector<OpenTypeTable>& tables,
ots::Buffer& file);
@ -263,7 +265,8 @@ bool ProcessTTF(ots::OpenTypeFile *header,
tables.push_back(table);
}
return ProcessGeneric(header, output, data, length, tables, file);
return ProcessGeneric(header, header->version, output, data, length,
tables, file);
}
bool ProcessWOFF(ots::OpenTypeFile *header,
@ -421,10 +424,11 @@ bool ProcessWOFF(ots::OpenTypeFile *header,
return OTS_FAILURE_MSG_HDR("file length mismatch (trailing junk?)");
}
return ProcessGeneric(header, output, data, length, tables, file);
return ProcessGeneric(header, woff_tag, output, data, length, tables, file);
}
bool ProcessGeneric(ots::OpenTypeFile *header, ots::OTSStream *output,
bool ProcessGeneric(ots::OpenTypeFile *header, uint32_t signature,
ots::OTSStream *output,
const uint8_t *data, size_t length,
const std::vector<OpenTypeTable>& tables,
ots::Buffer& file) {
@ -485,10 +489,11 @@ bool ProcessGeneric(ots::OpenTypeFile *header, ots::OTSStream *output,
}
// since we required that the file be < 1GB in length, and that the table
// length is < 1GB, the following addtion doesn't overflow
const uint32_t end_byte = tables[i].offset + tables[i].length;
// Some fonts which are automatically generated by a font generator
// called TTX seems not to add 0-padding to the final table. It might be
// ok to accept these fonts so we round up the length of the font file.
uint32_t end_byte = tables[i].offset + tables[i].length;
// Tables in the WOFF file must be aligned 4-byte boundary.
if (signature == Tag("wOFF")) {
end_byte = Round4(end_byte);
}
if (!end_byte || end_byte > length) {
return OTS_FAILURE_MSG_TAG("table overruns end of file", &tables[i].tag);
}