Loading gfx/ots/README.mozilla +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ This is the Sanitiser for OpenType project, from http://code.google.com/p/ots/. Our reference repository is https://github.com/khaledhosny/ots/. Current revision: 35643038c4904538aa74c2c691f8d792efdbd6c0 (9.0.0) Current revision: 75933e1bdc98bdb095f6274b284e1c365f2c510e (9.1.0) Upstream files included: LICENSE, src/, include/, tests/*.cc Loading gfx/ots/src/avar.cc +64 −9 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ #include "fvar.h" #include "variations.h" namespace ots { // ----------------------------------------------------------------------------- Loading @@ -20,9 +22,11 @@ bool OpenTypeAVAR::Parse(const uint8_t* data, size_t length) { !table.ReadU16(&this->axisCount)) { return Drop("Failed to read table header"); } if (this->majorVersion != 1) { if (this->majorVersion > 2) { return Drop("Unknown table version"); } if (this->majorVersion == 1) { // We can fix table if (this->minorVersion > 0) { // we only know how to serialize version 1.0 Warning("Downgrading minor version to 0"); Loading @@ -32,6 +36,15 @@ bool OpenTypeAVAR::Parse(const uint8_t* data, size_t length) { Warning("Expected reserved=0"); this->reserved = 0; } } else { // We serialize data unchanged, so drop even for minor errors if (this->minorVersion > 0) { return Drop("Unknown minor table version"); } if (this->reserved != 0) { return Drop("Expected reserved=0"); } } OpenTypeFVAR* fvar = static_cast<OpenTypeFVAR*>( GetFont()->GetTypedTable(OTS_TAG_FVAR)); Loading Loading @@ -79,10 +92,52 @@ bool OpenTypeAVAR::Parse(const uint8_t* data, size_t length) { } } if (this->majorVersion < 2) return true; uint32_t axisIndexMapOffset; uint32_t varStoreOffset; if (!table.ReadU32(&axisIndexMapOffset) || !table.ReadU32(&varStoreOffset)) { return Drop("Failed to read version 2 offsets"); } Font *font = GetFont(); uint32_t headerSize = table.offset(); if (axisIndexMapOffset) { if (axisIndexMapOffset < headerSize || axisIndexMapOffset >= length) { return Drop("Bad delta set index offset in table header"); } if (!ParseDeltaSetIndexMap(font, data + axisIndexMapOffset, length - axisIndexMapOffset)) { return Drop("Failed to parse delta set index map"); } } if (varStoreOffset) { if (varStoreOffset < headerSize || varStoreOffset >= length) { return Drop("Bad item variation store offset in table header"); } if (!ParseItemVariationStore(font, data + varStoreOffset, length - varStoreOffset)) { return Drop("Failed to parse item variation store"); } } this->m_data = data; this->m_length = length; return true; } bool OpenTypeAVAR::Serialize(OTSStream* out) { if (this->majorVersion >= 2) { if (!out->Write(this->m_data, this->m_length)) { return Error("Failed to write table"); } return true; } if (!out->WriteU16(this->majorVersion) || !out->WriteU16(this->minorVersion) || !out->WriteU16(this->reserved) || Loading gfx/ots/src/avar.h +4 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,10 @@ class OpenTypeAVAR : public Table { }; std::vector<std::vector<AxisValueMap>> axisSegmentMaps; // Only used for versions >= 2 const uint8_t *m_data; size_t m_length; }; } // namespace ots Loading gfx/ots/src/cff_charstring.cc +1 −1 Original line number Diff line number Diff line Loading @@ -384,7 +384,7 @@ bool ExecuteCharStringOperator(ots::OpenTypeCFF& cff, } uint16_t k = cff.region_index_count.at(cs_ctx.vsindex); uint16_t n = argument_stack->top(); if (stack_size < n * (k + 1) + 1) { if (stack_size < n * (k + 1u) + 1u) { return OTS_FAILURE(); } Loading gfx/ots/src/cpal.cc +2 −0 Original line number Diff line number Diff line Loading @@ -194,7 +194,9 @@ bool OpenTypeCPAL::Serialize(OTSStream *out) { uint16_t numPalettes = this->colorRecordIndices.size(); uint16_t numColorRecords = this->colorRecords.size(); #ifndef NDEBUG off_t start = out->Tell(); #endif size_t colorRecordsArrayOffset = 4 * sizeof(uint16_t) + sizeof(uint32_t) + numPalettes * sizeof(uint16_t); Loading Loading
gfx/ots/README.mozilla +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ This is the Sanitiser for OpenType project, from http://code.google.com/p/ots/. Our reference repository is https://github.com/khaledhosny/ots/. Current revision: 35643038c4904538aa74c2c691f8d792efdbd6c0 (9.0.0) Current revision: 75933e1bdc98bdb095f6274b284e1c365f2c510e (9.1.0) Upstream files included: LICENSE, src/, include/, tests/*.cc Loading
gfx/ots/src/avar.cc +64 −9 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ #include "fvar.h" #include "variations.h" namespace ots { // ----------------------------------------------------------------------------- Loading @@ -20,9 +22,11 @@ bool OpenTypeAVAR::Parse(const uint8_t* data, size_t length) { !table.ReadU16(&this->axisCount)) { return Drop("Failed to read table header"); } if (this->majorVersion != 1) { if (this->majorVersion > 2) { return Drop("Unknown table version"); } if (this->majorVersion == 1) { // We can fix table if (this->minorVersion > 0) { // we only know how to serialize version 1.0 Warning("Downgrading minor version to 0"); Loading @@ -32,6 +36,15 @@ bool OpenTypeAVAR::Parse(const uint8_t* data, size_t length) { Warning("Expected reserved=0"); this->reserved = 0; } } else { // We serialize data unchanged, so drop even for minor errors if (this->minorVersion > 0) { return Drop("Unknown minor table version"); } if (this->reserved != 0) { return Drop("Expected reserved=0"); } } OpenTypeFVAR* fvar = static_cast<OpenTypeFVAR*>( GetFont()->GetTypedTable(OTS_TAG_FVAR)); Loading Loading @@ -79,10 +92,52 @@ bool OpenTypeAVAR::Parse(const uint8_t* data, size_t length) { } } if (this->majorVersion < 2) return true; uint32_t axisIndexMapOffset; uint32_t varStoreOffset; if (!table.ReadU32(&axisIndexMapOffset) || !table.ReadU32(&varStoreOffset)) { return Drop("Failed to read version 2 offsets"); } Font *font = GetFont(); uint32_t headerSize = table.offset(); if (axisIndexMapOffset) { if (axisIndexMapOffset < headerSize || axisIndexMapOffset >= length) { return Drop("Bad delta set index offset in table header"); } if (!ParseDeltaSetIndexMap(font, data + axisIndexMapOffset, length - axisIndexMapOffset)) { return Drop("Failed to parse delta set index map"); } } if (varStoreOffset) { if (varStoreOffset < headerSize || varStoreOffset >= length) { return Drop("Bad item variation store offset in table header"); } if (!ParseItemVariationStore(font, data + varStoreOffset, length - varStoreOffset)) { return Drop("Failed to parse item variation store"); } } this->m_data = data; this->m_length = length; return true; } bool OpenTypeAVAR::Serialize(OTSStream* out) { if (this->majorVersion >= 2) { if (!out->Write(this->m_data, this->m_length)) { return Error("Failed to write table"); } return true; } if (!out->WriteU16(this->majorVersion) || !out->WriteU16(this->minorVersion) || !out->WriteU16(this->reserved) || Loading
gfx/ots/src/avar.h +4 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,10 @@ class OpenTypeAVAR : public Table { }; std::vector<std::vector<AxisValueMap>> axisSegmentMaps; // Only used for versions >= 2 const uint8_t *m_data; size_t m_length; }; } // namespace ots Loading
gfx/ots/src/cff_charstring.cc +1 −1 Original line number Diff line number Diff line Loading @@ -384,7 +384,7 @@ bool ExecuteCharStringOperator(ots::OpenTypeCFF& cff, } uint16_t k = cff.region_index_count.at(cs_ctx.vsindex); uint16_t n = argument_stack->top(); if (stack_size < n * (k + 1) + 1) { if (stack_size < n * (k + 1u) + 1u) { return OTS_FAILURE(); } Loading
gfx/ots/src/cpal.cc +2 −0 Original line number Diff line number Diff line Loading @@ -194,7 +194,9 @@ bool OpenTypeCPAL::Serialize(OTSStream *out) { uint16_t numPalettes = this->colorRecordIndices.size(); uint16_t numColorRecords = this->colorRecords.size(); #ifndef NDEBUG off_t start = out->Tell(); #endif size_t colorRecordsArrayOffset = 4 * sizeof(uint16_t) + sizeof(uint32_t) + numPalettes * sizeof(uint16_t); Loading