mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-29 09:34:05 +01:00
fix for cmap4 and OS_2 subsetting: maximum character code allowed is 0xFFFF
This commit is contained in:
1 parent
8ed46c3678
commit
1db2c1d0da
8 files changed
+37
-7
No files matched your search
+10
-4
@@ -242,8 +242,14 @@ struct CmapSubtableFormat4
|
||||
if (unlikely (!c->extend_min (*this))) return;
|
||||
this->format = 4;
|
||||
|
||||
auto format4_iter =
|
||||
+ it
|
||||
| hb_filter ([&] (const hb_pair_t<hb_codepoint_t, hb_codepoint_t> _)
|
||||
{ return _.first <= 0xFFFF; })
|
||||
;
|
||||
|
||||
//serialize endCode[]
|
||||
HBUINT16 *endCode = serialize_endcode_array (c, it);
|
||||
HBUINT16 *endCode = serialize_endcode_array (c, format4_iter);
|
||||
if (unlikely (!endCode)) return;
|
||||
|
||||
unsigned segcount = (c->length () - min_size) / HBUINT16::static_size;
|
||||
@@ -252,14 +258,14 @@ struct CmapSubtableFormat4
|
||||
if (unlikely (!c->allocate_size<HBUINT16> (HBUINT16::static_size))) return; // 2 bytes of padding.
|
||||
|
||||
// serialize startCode[]
|
||||
HBUINT16 *startCode = serialize_startcode_array (c, it);
|
||||
HBUINT16 *startCode = serialize_startcode_array (c, format4_iter);
|
||||
if (unlikely (!startCode)) return;
|
||||
|
||||
//serialize idDelta[]
|
||||
HBINT16 *idDelta = serialize_idDelta_array (c, it, endCode, startCode, segcount);
|
||||
HBINT16 *idDelta = serialize_idDelta_array (c, format4_iter, endCode, startCode, segcount);
|
||||
if (unlikely (!idDelta)) return;
|
||||
|
||||
HBUINT16 *idRangeOffset = serialize_rangeoffset_glyid (c, it, endCode, startCode, idDelta, segcount);
|
||||
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;
|
||||
|
||||
@@ -216,8 +216,8 @@ struct OS2
|
||||
uint16_t *min_cp, /* OUT */
|
||||
uint16_t *max_cp /* OUT */)
|
||||
{
|
||||
*min_cp = codepoints->get_min ();
|
||||
*max_cp = codepoints->get_max ();
|
||||
*min_cp = hb_min (0xFFFFu, codepoints->get_min ());
|
||||
*max_cp = hb_min (0xFFFFu, codepoints->get_max ());
|
||||
}
|
||||
|
||||
/* https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681 */
|
||||
|
||||
Reference in new issue
Block a user