summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-05-05 22:28:05 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-05-05 22:28:05 +0000
commitae18810d9334b628179c2aa19d06cfade25955cb (patch)
tree917ba096243e08241a3ee5ecb37890df6fe53566 /Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh
parent04c30db0018970c69516d748c7b4509240857b65 (diff)
harfbuzz 2.8.1
git-svn-id: svn://tug.org/texlive/trunk@59092 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh51
1 files changed, 28 insertions, 23 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh
index 878e02ff177..add21f11550 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh
@@ -276,7 +276,9 @@ struct CmapSubtableFormat4
HBUINT16 *idRangeOffset = serialize_rangeoffset_glyid (c, format4_iter, endCode, startCode, idDelta, segcount);
if (unlikely (!c->check_success (idRangeOffset))) return;
- if (unlikely (!c->check_assign(this->length, c->length () - table_initpos))) return;
+ if (unlikely (!c->check_assign(this->length,
+ c->length () - table_initpos,
+ HB_SERIALIZE_ERROR_INT_OVERFLOW))) return;
this->segCountX2 = segcount * 2;
this->entrySelector = hb_max (1u, hb_bit_storage (segcount)) - 1;
this->searchRange = 2 * (1u << this->entrySelector);
@@ -670,7 +672,7 @@ struct CmapSubtableLongSegmented
HBUINT16 reserved; /* Reserved; set to 0. */
HBUINT32 length; /* Byte length of this subtable. */
HBUINT32 language; /* Ignore. */
- SortedArrayOf<CmapSubtableLongGroup, HBUINT32>
+ SortedArray32Of<CmapSubtableLongGroup>
groups; /* Groupings. */
public:
DEFINE_SIZE_ARRAY (16, groups);
@@ -784,7 +786,7 @@ struct UnicodeValueRange
DEFINE_SIZE_STATIC (4);
};
-struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
+struct DefaultUVS : SortedArray32Of<UnicodeValueRange>
{
void collect_unicodes (hb_set_t *out) const
{
@@ -850,7 +852,9 @@ struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
}
else
{
- if (unlikely (!c->check_assign (out->len, (c->length () - init_len) / UnicodeValueRange::static_size))) return nullptr;
+ if (unlikely (!c->check_assign (out->len,
+ (c->length () - init_len) / UnicodeValueRange::static_size,
+ HB_SERIALIZE_ERROR_INT_OVERFLOW))) return nullptr;
return out;
}
}
@@ -876,23 +880,21 @@ struct UVSMapping
DEFINE_SIZE_STATIC (5);
};
-struct NonDefaultUVS : SortedArrayOf<UVSMapping, HBUINT32>
+struct NonDefaultUVS : SortedArray32Of<UVSMapping>
{
void collect_unicodes (hb_set_t *out) const
{
- unsigned int count = len;
- for (unsigned int i = 0; i < count; i++)
- out->add (arrayZ[i].unicodeValue);
+ for (const auto& a : as_array ())
+ out->add (a.unicodeValue);
}
void collect_mapping (hb_set_t *unicodes, /* OUT */
hb_map_t *mapping /* OUT */) const
{
- unsigned count = len;
- for (unsigned i = 0; i < count; i++)
+ for (const auto& a : as_array ())
{
- hb_codepoint_t unicode = arrayZ[i].unicodeValue;
- hb_codepoint_t glyphid = arrayZ[i].glyphID;
+ hb_codepoint_t unicode = a.unicodeValue;
+ hb_codepoint_t glyphid = a.glyphID;
unicodes->add (unicode);
mapping->set (unicode, glyphid);
}
@@ -1041,9 +1043,9 @@ struct VariationSelectorRecord
}
HBUINT24 varSelector; /* Variation selector. */
- LOffsetTo<DefaultUVS>
+ Offset32To<DefaultUVS>
defaultUVS; /* Offset to Default UVS Table. May be 0. */
- LOffsetTo<NonDefaultUVS>
+ Offset32To<NonDefaultUVS>
nonDefaultUVS; /* Offset to Non-Default UVS Table. May be 0. */
public:
DEFINE_SIZE_STATIC (11);
@@ -1058,9 +1060,8 @@ struct CmapSubtableFormat14
void collect_variation_selectors (hb_set_t *out) const
{
- unsigned int count = record.len;
- for (unsigned int i = 0; i < count; i++)
- out->add (record.arrayZ[i].varSelector);
+ for (const auto& a : record.as_array ())
+ out->add (a.varSelector);
}
void collect_variation_unicodes (hb_codepoint_t variation_selector,
hb_set_t *out) const
@@ -1112,10 +1113,12 @@ struct CmapSubtableFormat14
return;
int tail_len = init_tail - c->tail;
- c->check_assign (this->length, c->length () - table_initpos + tail_len);
+ c->check_assign (this->length, c->length () - table_initpos + tail_len,
+ HB_SERIALIZE_ERROR_INT_OVERFLOW);
c->check_assign (this->record.len,
(c->length () - table_initpos - CmapSubtableFormat14::min_size) /
- VariationSelectorRecord::static_size);
+ VariationSelectorRecord::static_size,
+ HB_SERIALIZE_ERROR_INT_OVERFLOW);
/* Correct the incorrect write order by reversing the order of the variation
records array. */
@@ -1180,7 +1183,7 @@ struct CmapSubtableFormat14
protected:
HBUINT16 format; /* Format number is set to 14. */
HBUINT32 length; /* Byte length of this subtable. */
- SortedArrayOf<VariationSelectorRecord, HBUINT32>
+ SortedArray32Of<VariationSelectorRecord>
record; /* Variation selector records; sorted
* in increasing order of `varSelector'. */
public:
@@ -1338,7 +1341,7 @@ struct EncodingRecord
HBUINT16 platformID; /* Platform ID. */
HBUINT16 encodingID; /* Platform-specific encoding ID. */
- LOffsetTo<CmapSubtable>
+ Offset32To<CmapSubtable>
subtable; /* Byte offset from beginning of table to the subtable for this encoding. */
public:
DEFINE_SIZE_STATIC (8);
@@ -1401,7 +1404,9 @@ struct cmap
}
}
- c->check_assign(this->encodingRecord.len, (c->length () - cmap::min_size)/EncodingRecord::static_size);
+ c->check_assign(this->encodingRecord.len,
+ (c->length () - cmap::min_size)/EncodingRecord::static_size,
+ HB_SERIALIZE_ERROR_INT_OVERFLOW);
}
void closure_glyphs (const hb_set_t *unicodes,
@@ -1697,7 +1702,7 @@ struct cmap
protected:
HBUINT16 version; /* Table version number (0). */
- SortedArrayOf<EncodingRecord>
+ SortedArray16Of<EncodingRecord>
encodingRecord; /* Encoding tables. */
public:
DEFINE_SIZE_ARRAY (4, encodingRecord);