@@ -633,8 +633,8 @@ struct GDEFVersion1_2
633633 ligCaretList.sanitize (c, this ) &&
634634 markAttachClassDef.sanitize (c, this ) &&
635635 hb_barrier () &&
636- (version.to_int () < 0x00010002u || markGlyphSetsDef.sanitize (c, this )) &&
637- (version.to_int () < 0x00010003u || varStore.sanitize (c, this )));
636+ (( version.to_int () < 0x00010002u && hb_barrier ()) || markGlyphSetsDef.sanitize (c, this )) &&
637+ (( version.to_int () < 0x00010003u && hb_barrier ()) || varStore.sanitize (c, this )));
638638 }
639639
640640 static void remap_varidx_after_instantiation (const hb_map_t & varidx_map,
@@ -668,13 +668,13 @@ struct GDEFVersion1_2
668668 // the end of the GDEF table.
669669 // See: https://github.com/harfbuzz/harfbuzz/issues/4636
670670 auto snapshot_version0 = c->serializer ->snapshot ();
671- if (unlikely (version.to_int () >= 0x00010002u && !c->serializer ->embed (markGlyphSetsDef)))
671+ if (unlikely (version.to_int () >= 0x00010002u && hb_barrier () && !c->serializer ->embed (markGlyphSetsDef)))
672672 return_trace (false );
673673
674674 bool subset_varstore = false ;
675675 unsigned varstore_index = (unsigned ) -1 ;
676676 auto snapshot_version2 = c->serializer ->snapshot ();
677- if (version.to_int () >= 0x00010003u )
677+ if (version.to_int () >= 0x00010003u && hb_barrier () )
678678 {
679679 if (unlikely (!c->serializer ->embed (varStore))) return_trace (false );
680680 if (c->plan ->all_axes_pinned )
@@ -712,7 +712,7 @@ struct GDEFVersion1_2
712712 }
713713
714714 bool subset_markglyphsetsdef = false ;
715- if (version.to_int () >= 0x00010002u )
715+ if (version.to_int () >= 0x00010002u && hb_barrier () )
716716 {
717717 subset_markglyphsetsdef = out->markGlyphSetsDef .serialize_subset (c, markGlyphSetsDef, this );
718718 }
@@ -875,7 +875,7 @@ struct GDEF
875875 bool has_mark_glyph_sets () const
876876 {
877877 switch (u.version .major ) {
878- case 1 : return u.version .to_int () >= 0x00010002u && u.version1 .markGlyphSetsDef != 0 ;
878+ case 1 : return u.version .to_int () >= 0x00010002u && hb_barrier () && u.version1 .markGlyphSetsDef != 0 ;
879879#ifndef HB_NO_BEYOND_64K
880880 case 2 : return u.version2 .markGlyphSetsDef != 0 ;
881881#endif
@@ -885,7 +885,7 @@ struct GDEF
885885 const MarkGlyphSets &get_mark_glyph_sets () const
886886 {
887887 switch (u.version .major ) {
888- case 1 : return u.version .to_int () >= 0x00010002u ? this +u.version1 .markGlyphSetsDef : Null (MarkGlyphSets);
888+ case 1 : return u.version .to_int () >= 0x00010002u && hb_barrier () ? this +u.version1 .markGlyphSetsDef : Null (MarkGlyphSets);
889889#ifndef HB_NO_BEYOND_64K
890890 case 2 : return this +u.version2 .markGlyphSetsDef ;
891891#endif
@@ -895,7 +895,7 @@ struct GDEF
895895 bool has_var_store () const
896896 {
897897 switch (u.version .major ) {
898- case 1 : return u.version .to_int () >= 0x00010003u && u.version1 .varStore != 0 ;
898+ case 1 : return u.version .to_int () >= 0x00010003u && hb_barrier () && u.version1 .varStore != 0 ;
899899#ifndef HB_NO_BEYOND_64K
900900 case 2 : return u.version2 .varStore != 0 ;
901901#endif
@@ -905,7 +905,7 @@ struct GDEF
905905 const ItemVariationStore &get_var_store () const
906906 {
907907 switch (u.version .major ) {
908- case 1 : return u.version .to_int () >= 0x00010003u ? this +u.version1 .varStore : Null (ItemVariationStore);
908+ case 1 : return u.version .to_int () >= 0x00010003u && hb_barrier () ? this +u.version1 .varStore : Null (ItemVariationStore);
909909#ifndef HB_NO_BEYOND_64K
910910 case 2 : return this +u.version2 .varStore ;
911911#endif
0 commit comments