From 15cc5901965dfb68c6408d744fd4d669be7efc93 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Thu, 7 Jun 2012 17:00:13 +0100 Subject: [PATCH] bug 762484 - update OTS to upstream rev.92. r=emk --- gfx/ots/README.mozilla | 2 +- gfx/ots/src/ots.cc | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gfx/ots/README.mozilla b/gfx/ots/README.mozilla index 221ddc4db90..c32e8db82db 100644 --- a/gfx/ots/README.mozilla +++ b/gfx/ots/README.mozilla @@ -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) diff --git a/gfx/ots/src/ots.cc b/gfx/ots/src/ots.cc index 07a980f076f..25b9ed26733 100644 --- a/gfx/ots/src/ots.cc +++ b/gfx/ots/src/ots.cc @@ -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& 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& 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); }