Add more hb_barrier()s in switches (#6106)

Fixes https://github.com/harfbuzz/harfbuzz/security/advisories/GHSA-pmg2-m89x-pc6j
This commit is contained in:
Behdad Esfahbod authored and GitHub committed 2026-07-27 19:20:18 -06:00
1 parent f3dea1e602
commit da7f951ef0
31 files changed
+316 -245

No files matched your search

+10 -7
View File
@@ -207,8 +207,8 @@ struct IndexSubtable
hb_barrier ();
switch (u.header.indexFormat)
{
case 1: return_trace (u.format1.sanitize (c, glyph_count));
case 3: return_trace (u.format3.sanitize (c, glyph_count));
case 1: hb_barrier (); return_trace (u.format1.sanitize (c, glyph_count));
case 3: hb_barrier (); return_trace (u.format3.sanitize (c, glyph_count));
default:return_trace (true);
}
}
@@ -224,8 +224,9 @@ struct IndexSubtable
unsigned int local_offset = cbdt_prime_len - u.header.imageDataOffset;
switch (u.header.indexFormat)
{
case 1: return_trace (u.format1.add_offset (c, local_offset, size));
case 1: hb_barrier (); return_trace (u.format1.add_offset (c, local_offset, size));
case 3: {
hb_barrier ();
if (!u.format3.add_offset (c, local_offset, size))
return_trace (false);
if (!(num_glyphs & 0x01)) // Pad to 32-bit alignment if needed.
@@ -252,6 +253,7 @@ struct IndexSubtable
switch (u.header.indexFormat)
{
case 1: {
hb_barrier ();
for (unsigned int i = 0; i < num_missing; i++)
{
if (unlikely (!u.format1.add_offset (c, local_offset, size)))
@@ -261,6 +263,7 @@ struct IndexSubtable
return_trace (true);
}
case 3: {
hb_barrier ();
for (unsigned int i = 0; i < num_missing; i++)
{
if (unlikely (!u.format3.add_offset (c, local_offset, size)))
@@ -303,8 +306,8 @@ struct IndexSubtable
TRACE_SERIALIZE (this);
switch (u.header.indexFormat)
{
case 1: return_trace (u.format1.add_offset (c, local_offset, size));
case 3: return_trace (u.format3.add_offset (c, local_offset, size));
case 1: hb_barrier (); return_trace (u.format1.add_offset (c, local_offset, size));
case 3: hb_barrier (); return_trace (u.format3.add_offset (c, local_offset, size));
// TODO: Implement tables 2, 4, 5
case 2: // Should be a no-op.
case 4: case 5: // Handle sparse cases.
@@ -329,8 +332,8 @@ struct IndexSubtable
*format = u.header.imageFormat;
switch (u.header.indexFormat)
{
case 1: return u.format1.get_image_data (idx, offset, length);
case 3: return u.format3.get_image_data (idx, offset, length);
case 1: hb_barrier (); return u.format1.get_image_data (idx, offset, length);
case 3: hb_barrier (); return u.format3.get_image_data (idx, offset, length);
default: return false;
}
}
+41 -39
View File
@@ -1636,8 +1636,8 @@ struct ClipBox
{
TRACE_SUBSET (this);
switch (u.format.v) {
case 1: return_trace (u.format1.subset (c, instancer, VarIdx::NO_VARIATION));
case 2: return_trace (u.format2.subset (c, instancer));
case 1: hb_barrier (); return_trace (u.format1.subset (c, instancer, VarIdx::NO_VARIATION));
case 2: hb_barrier (); return_trace (u.format2.subset (c, instancer));
default:return_trace (c->default_return_value ());
}
}
@@ -1645,7 +1645,7 @@ struct ClipBox
void closurev1 (hb_colrv1_closure_context_t* c) const
{
switch (u.format.v) {
case 2: u.format2.closurev1 (c); return;
case 2: hb_barrier (); u.format2.closurev1 (c); return;
default:return;
}
}
@@ -1656,8 +1656,8 @@ struct ClipBox
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
default:return_trace (c->default_return_value ());
}
}
@@ -1668,9 +1668,11 @@ struct ClipBox
ClipBoxData clip_box;
switch (u.format.v) {
case 1:
hb_barrier ();
u.format1.get_clip_box (clip_box, instancer);
break;
case 2:
hb_barrier ();
u.format2.get_clip_box (clip_box, instancer);
break;
default:
@@ -1866,38 +1868,38 @@ struct Paint
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.paintformat1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.paintformat2, std::forward<Ts> (ds)...));
case 3: return_trace (c->dispatch (u.paintformat3, std::forward<Ts> (ds)...));
case 4: return_trace (c->dispatch (u.paintformat4, std::forward<Ts> (ds)...));
case 5: return_trace (c->dispatch (u.paintformat5, std::forward<Ts> (ds)...));
case 6: return_trace (c->dispatch (u.paintformat6, std::forward<Ts> (ds)...));
case 7: return_trace (c->dispatch (u.paintformat7, std::forward<Ts> (ds)...));
case 8: return_trace (c->dispatch (u.paintformat8, std::forward<Ts> (ds)...));
case 9: return_trace (c->dispatch (u.paintformat9, std::forward<Ts> (ds)...));
case 10: return_trace (c->dispatch (u.paintformat10, std::forward<Ts> (ds)...));
case 11: return_trace (c->dispatch (u.paintformat11, std::forward<Ts> (ds)...));
case 12: return_trace (c->dispatch (u.paintformat12, std::forward<Ts> (ds)...));
case 13: return_trace (c->dispatch (u.paintformat13, std::forward<Ts> (ds)...));
case 14: return_trace (c->dispatch (u.paintformat14, std::forward<Ts> (ds)...));
case 15: return_trace (c->dispatch (u.paintformat15, std::forward<Ts> (ds)...));
case 16: return_trace (c->dispatch (u.paintformat16, std::forward<Ts> (ds)...));
case 17: return_trace (c->dispatch (u.paintformat17, std::forward<Ts> (ds)...));
case 18: return_trace (c->dispatch (u.paintformat18, std::forward<Ts> (ds)...));
case 19: return_trace (c->dispatch (u.paintformat19, std::forward<Ts> (ds)...));
case 20: return_trace (c->dispatch (u.paintformat20, std::forward<Ts> (ds)...));
case 21: return_trace (c->dispatch (u.paintformat21, std::forward<Ts> (ds)...));
case 22: return_trace (c->dispatch (u.paintformat22, std::forward<Ts> (ds)...));
case 23: return_trace (c->dispatch (u.paintformat23, std::forward<Ts> (ds)...));
case 24: return_trace (c->dispatch (u.paintformat24, std::forward<Ts> (ds)...));
case 25: return_trace (c->dispatch (u.paintformat25, std::forward<Ts> (ds)...));
case 26: return_trace (c->dispatch (u.paintformat26, std::forward<Ts> (ds)...));
case 27: return_trace (c->dispatch (u.paintformat27, std::forward<Ts> (ds)...));
case 28: return_trace (c->dispatch (u.paintformat28, std::forward<Ts> (ds)...));
case 29: return_trace (c->dispatch (u.paintformat29, std::forward<Ts> (ds)...));
case 30: return_trace (c->dispatch (u.paintformat30, std::forward<Ts> (ds)...));
case 31: return_trace (c->dispatch (u.paintformat31, std::forward<Ts> (ds)...));
case 32: return_trace (c->dispatch (u.paintformat32, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.paintformat1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.paintformat2, std::forward<Ts> (ds)...));
case 3: hb_barrier (); return_trace (c->dispatch (u.paintformat3, std::forward<Ts> (ds)...));
case 4: hb_barrier (); return_trace (c->dispatch (u.paintformat4, std::forward<Ts> (ds)...));
case 5: hb_barrier (); return_trace (c->dispatch (u.paintformat5, std::forward<Ts> (ds)...));
case 6: hb_barrier (); return_trace (c->dispatch (u.paintformat6, std::forward<Ts> (ds)...));
case 7: hb_barrier (); return_trace (c->dispatch (u.paintformat7, std::forward<Ts> (ds)...));
case 8: hb_barrier (); return_trace (c->dispatch (u.paintformat8, std::forward<Ts> (ds)...));
case 9: hb_barrier (); return_trace (c->dispatch (u.paintformat9, std::forward<Ts> (ds)...));
case 10: hb_barrier (); return_trace (c->dispatch (u.paintformat10, std::forward<Ts> (ds)...));
case 11: hb_barrier (); return_trace (c->dispatch (u.paintformat11, std::forward<Ts> (ds)...));
case 12: hb_barrier (); return_trace (c->dispatch (u.paintformat12, std::forward<Ts> (ds)...));
case 13: hb_barrier (); return_trace (c->dispatch (u.paintformat13, std::forward<Ts> (ds)...));
case 14: hb_barrier (); return_trace (c->dispatch (u.paintformat14, std::forward<Ts> (ds)...));
case 15: hb_barrier (); return_trace (c->dispatch (u.paintformat15, std::forward<Ts> (ds)...));
case 16: hb_barrier (); return_trace (c->dispatch (u.paintformat16, std::forward<Ts> (ds)...));
case 17: hb_barrier (); return_trace (c->dispatch (u.paintformat17, std::forward<Ts> (ds)...));
case 18: hb_barrier (); return_trace (c->dispatch (u.paintformat18, std::forward<Ts> (ds)...));
case 19: hb_barrier (); return_trace (c->dispatch (u.paintformat19, std::forward<Ts> (ds)...));
case 20: hb_barrier (); return_trace (c->dispatch (u.paintformat20, std::forward<Ts> (ds)...));
case 21: hb_barrier (); return_trace (c->dispatch (u.paintformat21, std::forward<Ts> (ds)...));
case 22: hb_barrier (); return_trace (c->dispatch (u.paintformat22, std::forward<Ts> (ds)...));
case 23: hb_barrier (); return_trace (c->dispatch (u.paintformat23, std::forward<Ts> (ds)...));
case 24: hb_barrier (); return_trace (c->dispatch (u.paintformat24, std::forward<Ts> (ds)...));
case 25: hb_barrier (); return_trace (c->dispatch (u.paintformat25, std::forward<Ts> (ds)...));
case 26: hb_barrier (); return_trace (c->dispatch (u.paintformat26, std::forward<Ts> (ds)...));
case 27: hb_barrier (); return_trace (c->dispatch (u.paintformat27, std::forward<Ts> (ds)...));
case 28: hb_barrier (); return_trace (c->dispatch (u.paintformat28, std::forward<Ts> (ds)...));
case 29: hb_barrier (); return_trace (c->dispatch (u.paintformat29, std::forward<Ts> (ds)...));
case 30: hb_barrier (); return_trace (c->dispatch (u.paintformat30, std::forward<Ts> (ds)...));
case 31: hb_barrier (); return_trace (c->dispatch (u.paintformat31, std::forward<Ts> (ds)...));
case 32: hb_barrier (); return_trace (c->dispatch (u.paintformat32, std::forward<Ts> (ds)...));
default:return_trace (c->default_return_value ());
}
}
@@ -1906,8 +1908,8 @@ struct Paint
hb_bool_t *is_foreground, hb_color_t *color) const
{
switch (u.format.v) {
case 2: u.paintformat2.get_solid_color (c, is_foreground, color); return true;
case 3: u.paintformat3.get_solid_color (c, is_foreground, color); return true;
case 2: hb_barrier (); u.paintformat2.get_solid_color (c, is_foreground, color); return true;
case 3: hb_barrier (); u.paintformat3.get_solid_color (c, is_foreground, color); return true;
default: return false;
}
}
+56 -56
View File
@@ -67,11 +67,11 @@ struct Coverage
hb_barrier ();
switch (u.format.v)
{
case 1: return_trace (u.format1.sanitize (c));
case 2: return_trace (u.format2.sanitize (c));
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
#ifndef HB_NO_BEYOND_64K
case 3: return_trace (u.format3.sanitize (c));
case 4: return_trace (u.format4.sanitize (c));
case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
case 4: hb_barrier (); return_trace (u.format4.sanitize (c));
#endif
default:return_trace (true);
}
@@ -87,11 +87,11 @@ struct Coverage
unsigned int get_coverage (hb_codepoint_t glyph_id) const
{
switch (u.format.v) {
case 1: return u.format1.get_coverage (glyph_id);
case 2: return u.format2.get_coverage (glyph_id);
case 1: hb_barrier (); return u.format1.get_coverage (glyph_id);
case 2: hb_barrier (); return u.format2.get_coverage (glyph_id);
#ifndef HB_NO_BEYOND_64K
case 3: return u.format3.get_coverage (glyph_id);
case 4: return u.format4.get_coverage (glyph_id);
case 3: hb_barrier (); return u.format3.get_coverage (glyph_id);
case 4: hb_barrier (); return u.format4.get_coverage (glyph_id);
#endif
default:return NOT_COVERED;
}
@@ -129,11 +129,11 @@ struct Coverage
unsigned get_population () const
{
switch (u.format.v) {
case 1: return u.format1.get_population ();
case 2: return u.format2.get_population ();
case 1: hb_barrier (); return u.format1.get_population ();
case 2: hb_barrier (); return u.format2.get_population ();
#ifndef HB_NO_BEYOND_64K
case 3: return u.format3.get_population ();
case 4: return u.format4.get_population ();
case 3: hb_barrier (); return u.format3.get_population ();
case 4: hb_barrier (); return u.format4.get_population ();
#endif
default:return NOT_COVERED;
}
@@ -176,11 +176,11 @@ struct Coverage
switch (u.format.v)
{
case 1: return_trace (u.format1.serialize (c, glyphs));
case 2: return_trace (u.format2.serialize (c, glyphs));
case 1: hb_barrier (); return_trace (u.format1.serialize (c, glyphs));
case 2: hb_barrier (); return_trace (u.format2.serialize (c, glyphs));
#ifndef HB_NO_BEYOND_64K
case 3: return_trace (u.format3.serialize (c, glyphs));
case 4: return_trace (u.format4.serialize (c, glyphs));
case 3: hb_barrier (); return_trace (u.format3.serialize (c, glyphs));
case 4: hb_barrier (); return_trace (u.format4.serialize (c, glyphs));
#endif
default:return_trace (false);
}
@@ -207,11 +207,11 @@ struct Coverage
{
switch (u.format.v)
{
case 1: return u.format1.intersects (glyphs);
case 2: return u.format2.intersects (glyphs);
case 1: hb_barrier (); return u.format1.intersects (glyphs);
case 2: hb_barrier (); return u.format2.intersects (glyphs);
#ifndef HB_NO_BEYOND_64K
case 3: return u.format3.intersects (glyphs);
case 4: return u.format4.intersects (glyphs);
case 3: hb_barrier (); return u.format3.intersects (glyphs);
case 4: hb_barrier (); return u.format4.intersects (glyphs);
#endif
default:return false;
}
@@ -220,11 +220,11 @@ struct Coverage
{
switch (u.format.v)
{
case 1: return u.format1.intersects_coverage (glyphs, index);
case 2: return u.format2.intersects_coverage (glyphs, index);
case 1: hb_barrier (); return u.format1.intersects_coverage (glyphs, index);
case 2: hb_barrier (); return u.format2.intersects_coverage (glyphs, index);
#ifndef HB_NO_BEYOND_64K
case 3: return u.format3.intersects_coverage (glyphs, index);
case 4: return u.format4.intersects_coverage (glyphs, index);
case 3: hb_barrier (); return u.format3.intersects_coverage (glyphs, index);
case 4: hb_barrier (); return u.format4.intersects_coverage (glyphs, index);
#endif
default:return false;
}
@@ -250,11 +250,11 @@ struct Coverage
{
switch (u.format.v)
{
case 1: return u.format1.collect_coverage (glyphs);
case 2: return u.format2.collect_coverage (glyphs);
case 1: hb_barrier (); return u.format1.collect_coverage (glyphs);
case 2: hb_barrier (); return u.format2.collect_coverage (glyphs);
#ifndef HB_NO_BEYOND_64K
case 3: return u.format3.collect_coverage (glyphs);
case 4: return u.format4.collect_coverage (glyphs);
case 3: hb_barrier (); return u.format3.collect_coverage (glyphs);
case 4: hb_barrier (); return u.format4.collect_coverage (glyphs);
#endif
default:return false;
}
@@ -266,11 +266,11 @@ struct Coverage
{
switch (u.format.v)
{
case 1: return u.format1.intersect_set (glyphs, intersect_glyphs);
case 2: return u.format2.intersect_set (glyphs, intersect_glyphs);
case 1: hb_barrier (); return u.format1.intersect_set (glyphs, intersect_glyphs);
case 2: hb_barrier (); return u.format2.intersect_set (glyphs, intersect_glyphs);
#ifndef HB_NO_BEYOND_64K
case 3: return u.format3.intersect_set (glyphs, intersect_glyphs);
case 4: return u.format4.intersect_set (glyphs, intersect_glyphs);
case 3: hb_barrier (); return u.format3.intersect_set (glyphs, intersect_glyphs);
case 4: hb_barrier (); return u.format4.intersect_set (glyphs, intersect_glyphs);
#endif
default:return ;
}
@@ -285,11 +285,11 @@ struct Coverage
format = c_.u.format.v;
switch (format)
{
case 1: u.format1.init (c_.u.format1); return;
case 2: u.format2.init (c_.u.format2); return;
case 1: hb_barrier (); u.format1.init (c_.u.format1); return;
case 2: hb_barrier (); u.format2.init (c_.u.format2); return;
#ifndef HB_NO_BEYOND_64K
case 3: u.format3.init (c_.u.format3); return;
case 4: u.format4.init (c_.u.format4); return;
case 3: hb_barrier (); u.format3.init (c_.u.format3); return;
case 4: hb_barrier (); u.format4.init (c_.u.format4); return;
#endif
default: return;
}
@@ -298,11 +298,11 @@ struct Coverage
{
switch (format)
{
case 1: return u.format1.__more__ ();
case 2: return u.format2.__more__ ();
case 1: hb_barrier (); return u.format1.__more__ ();
case 2: hb_barrier (); return u.format2.__more__ ();
#ifndef HB_NO_BEYOND_64K
case 3: return u.format3.__more__ ();
case 4: return u.format4.__more__ ();
case 3: hb_barrier (); return u.format3.__more__ ();
case 4: hb_barrier (); return u.format4.__more__ ();
#endif
default:return false;
}
@@ -311,11 +311,11 @@ struct Coverage
{
switch (format)
{
case 1: u.format1.__next__ (); break;
case 2: u.format2.__next__ (); break;
case 1: hb_barrier (); u.format1.__next__ (); break;
case 2: hb_barrier (); u.format2.__next__ (); break;
#ifndef HB_NO_BEYOND_64K
case 3: u.format3.__next__ (); break;
case 4: u.format4.__next__ (); break;
case 3: hb_barrier (); u.format3.__next__ (); break;
case 4: hb_barrier (); u.format4.__next__ (); break;
#endif
default: break;
}
@@ -327,11 +327,11 @@ struct Coverage
{
switch (format)
{
case 1: return u.format1.get_glyph ();
case 2: return u.format2.get_glyph ();
case 1: hb_barrier (); return u.format1.get_glyph ();
case 2: hb_barrier (); return u.format2.get_glyph ();
#ifndef HB_NO_BEYOND_64K
case 3: return u.format3.get_glyph ();
case 4: return u.format4.get_glyph ();
case 3: hb_barrier (); return u.format3.get_glyph ();
case 4: hb_barrier (); return u.format4.get_glyph ();
#endif
default:return 0;
}
@@ -341,11 +341,11 @@ struct Coverage
if (unlikely (format != o.format)) return true;
switch (format)
{
case 1: return u.format1 != o.u.format1;
case 2: return u.format2 != o.u.format2;
case 1: hb_barrier (); return u.format1 != o.u.format1;
case 2: hb_barrier (); return u.format2 != o.u.format2;
#ifndef HB_NO_BEYOND_64K
case 3: return u.format3 != o.u.format3;
case 4: return u.format4 != o.u.format4;
case 3: hb_barrier (); return u.format3 != o.u.format3;
case 4: hb_barrier (); return u.format4 != o.u.format4;
#endif
default:return false;
}
@@ -356,11 +356,11 @@ struct Coverage
it.format = format;
switch (format)
{
case 1: it.u.format1 = u.format1.__end__ (); break;
case 2: it.u.format2 = u.format2.__end__ (); break;
case 1: hb_barrier (); it.u.format1 = u.format1.__end__ (); break;
case 2: hb_barrier (); it.u.format2 = u.format2.__end__ (); break;
#ifndef HB_NO_BEYOND_64K
case 3: it.u.format3 = u.format3.__end__ (); break;
case 4: it.u.format4 = u.format4.__end__ (); break;
case 3: hb_barrier (); it.u.format3 = u.format3.__end__ (); break;
case 4: hb_barrier (); it.u.format4 = u.format4.__end__ (); break;
#endif
default: break;
}
+41 -40
View File
@@ -253,9 +253,9 @@ struct CaretValue
const ItemVariationStore &var_store) const
{
switch (u.format.v) {
case 1: return u.format1.get_caret_value (font, direction);
case 2: return u.format2.get_caret_value (font, direction, glyph_id);
case 3: return u.format3.get_caret_value (font, direction, var_store);
case 1: hb_barrier (); return u.format1.get_caret_value (font, direction);
case 2: hb_barrier (); return u.format2.get_caret_value (font, direction, glyph_id);
case 3: hb_barrier (); return u.format3.get_caret_value (font, direction, var_store);
default:return 0;
}
}
@@ -266,9 +266,9 @@ struct CaretValue
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
default:return_trace (c->default_return_value ());
}
}
@@ -280,6 +280,7 @@ struct CaretValue
case 2:
return;
case 3:
hb_barrier ();
u.format3.collect_variation_indices (c);
return;
default: return;
@@ -292,9 +293,9 @@ struct CaretValue
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format.v) {
case 1: return_trace (u.format1.sanitize (c));
case 2: return_trace (u.format2.sanitize (c));
case 3: return_trace (u.format3.sanitize (c));
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
default:return_trace (true);
}
}
@@ -520,7 +521,7 @@ struct MarkGlyphSets
bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
{
switch (u.format.v) {
case 1: return u.format1.covers (set_index, glyph_id);
case 1: hb_barrier (); return u.format1.covers (set_index, glyph_id);
default:return false;
}
}
@@ -529,7 +530,7 @@ struct MarkGlyphSets
void collect_coverage (hb_vector_t<set_t> &sets) const
{
switch (u.format.v) {
case 1: u.format1.collect_coverage (sets); return;
case 1: hb_barrier (); u.format1.collect_coverage (sets); return;
default:return;
}
}
@@ -538,7 +539,7 @@ struct MarkGlyphSets
hb_set_t& used_mark_sets /* OUT */) const
{
switch (u.format.v) {
case 1: u.format1.collect_used_mark_sets (glyph_set, used_mark_sets); return;
case 1: hb_barrier (); u.format1.collect_used_mark_sets (glyph_set, used_mark_sets); return;
default:return;
}
}
@@ -547,7 +548,7 @@ struct MarkGlyphSets
{
TRACE_SUBSET (this);
switch (u.format.v) {
case 1: return_trace (u.format1.subset (c));
case 1: hb_barrier (); return_trace (u.format1.subset (c));
default:return_trace (false);
}
}
@@ -558,7 +559,7 @@ struct MarkGlyphSets
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format.v) {
case 1: return_trace (u.format1.sanitize (c));
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
default:return_trace (true);
}
}
@@ -758,9 +759,9 @@ struct GDEF
size_t get_size () const
{
switch (u.version.major) {
case 1: return u.version1.get_size ();
case 1: hb_barrier (); return u.version1.get_size ();
#ifndef HB_NO_BEYOND_64K
case 2: return u.version2.get_size ();
case 2: hb_barrier (); return u.version2.get_size ();
#endif
default: return u.version.static_size;
}
@@ -772,9 +773,9 @@ struct GDEF
if (unlikely (!u.version.sanitize (c))) return_trace (false);
hb_barrier ();
switch (u.version.major) {
case 1: return_trace (u.version1.sanitize (c));
case 1: hb_barrier (); return_trace (u.version1.sanitize (c));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (u.version2.sanitize (c));
case 2: hb_barrier (); return_trace (u.version2.sanitize (c));
#endif
default: return_trace (true);
}
@@ -783,9 +784,9 @@ struct GDEF
bool subset (hb_subset_context_t *c) const
{
switch (u.version.major) {
case 1: return u.version1.subset (c);
case 1: hb_barrier (); return u.version1.subset (c);
#ifndef HB_NO_BEYOND_64K
case 2: return u.version2.subset (c);
case 2: hb_barrier (); return u.version2.subset (c);
#endif
default: return false;
}
@@ -794,9 +795,9 @@ struct GDEF
bool has_glyph_classes () const
{
switch (u.version.major) {
case 1: return u.version1.glyphClassDef != 0;
case 1: hb_barrier (); return u.version1.glyphClassDef != 0;
#ifndef HB_NO_BEYOND_64K
case 2: return u.version2.glyphClassDef != 0;
case 2: hb_barrier (); return u.version2.glyphClassDef != 0;
#endif
default: return false;
}
@@ -804,9 +805,9 @@ struct GDEF
const ClassDef &get_glyph_class_def () const
{
switch (u.version.major) {
case 1: return this+u.version1.glyphClassDef;
case 1: hb_barrier (); return this+u.version1.glyphClassDef;
#ifndef HB_NO_BEYOND_64K
case 2: return this+u.version2.glyphClassDef;
case 2: hb_barrier (); return this+u.version2.glyphClassDef;
#endif
default: return Null(ClassDef);
}
@@ -814,9 +815,9 @@ struct GDEF
bool has_attach_list () const
{
switch (u.version.major) {
case 1: return u.version1.attachList != 0;
case 1: hb_barrier (); return u.version1.attachList != 0;
#ifndef HB_NO_BEYOND_64K
case 2: return u.version2.attachList != 0;
case 2: hb_barrier (); return u.version2.attachList != 0;
#endif
default: return false;
}
@@ -824,9 +825,9 @@ struct GDEF
const AttachList &get_attach_list () const
{
switch (u.version.major) {
case 1: return this+u.version1.attachList;
case 1: hb_barrier (); return this+u.version1.attachList;
#ifndef HB_NO_BEYOND_64K
case 2: return this+u.version2.attachList;
case 2: hb_barrier (); return this+u.version2.attachList;
#endif
default: return Null(AttachList);
}
@@ -834,9 +835,9 @@ struct GDEF
bool has_lig_carets () const
{
switch (u.version.major) {
case 1: return u.version1.ligCaretList != 0;
case 1: hb_barrier (); return u.version1.ligCaretList != 0;
#ifndef HB_NO_BEYOND_64K
case 2: return u.version2.ligCaretList != 0;
case 2: hb_barrier (); return u.version2.ligCaretList != 0;
#endif
default: return false;
}
@@ -844,9 +845,9 @@ struct GDEF
const LigCaretList &get_lig_caret_list () const
{
switch (u.version.major) {
case 1: return this+u.version1.ligCaretList;
case 1: hb_barrier (); return this+u.version1.ligCaretList;
#ifndef HB_NO_BEYOND_64K
case 2: return this+u.version2.ligCaretList;
case 2: hb_barrier (); return this+u.version2.ligCaretList;
#endif
default: return Null(LigCaretList);
}
@@ -854,9 +855,9 @@ struct GDEF
bool has_mark_attachment_types () const
{
switch (u.version.major) {
case 1: return u.version1.markAttachClassDef != 0;
case 1: hb_barrier (); return u.version1.markAttachClassDef != 0;
#ifndef HB_NO_BEYOND_64K
case 2: return u.version2.markAttachClassDef != 0;
case 2: hb_barrier (); return u.version2.markAttachClassDef != 0;
#endif
default: return false;
}
@@ -864,9 +865,9 @@ struct GDEF
const ClassDef &get_mark_attach_class_def () const
{
switch (u.version.major) {
case 1: return this+u.version1.markAttachClassDef;
case 1: hb_barrier (); return this+u.version1.markAttachClassDef;
#ifndef HB_NO_BEYOND_64K
case 2: return this+u.version2.markAttachClassDef;
case 2: hb_barrier (); return this+u.version2.markAttachClassDef;
#endif
default: return Null(ClassDef);
}
@@ -876,7 +877,7 @@ struct GDEF
switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010002u && hb_barrier () && u.version1.markGlyphSetsDef != 0;
#ifndef HB_NO_BEYOND_64K
case 2: return u.version2.markGlyphSetsDef != 0;
case 2: hb_barrier (); return u.version2.markGlyphSetsDef != 0;
#endif
default: return false;
}
@@ -886,7 +887,7 @@ struct GDEF
switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010002u && hb_barrier () ? this+u.version1.markGlyphSetsDef : Null(MarkGlyphSets);
#ifndef HB_NO_BEYOND_64K
case 2: return this+u.version2.markGlyphSetsDef;
case 2: hb_barrier (); return this+u.version2.markGlyphSetsDef;
#endif
default: return Null(MarkGlyphSets);
}
@@ -896,7 +897,7 @@ struct GDEF
switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010003u && hb_barrier () && u.version1.varStore != 0;
#ifndef HB_NO_BEYOND_64K
case 2: return u.version2.varStore != 0;
case 2: hb_barrier (); return u.version2.varStore != 0;
#endif
default: return false;
}
@@ -906,7 +907,7 @@ struct GDEF
switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010003u && hb_barrier () ? this+u.version1.varStore : Null(ItemVariationStore);
#ifndef HB_NO_BEYOND_64K
case 2: return this+u.version2.varStore;
case 2: hb_barrier (); return this+u.version2.varStore;
#endif
default: return Null(ItemVariationStore);
}
+10 -8
View File
@@ -27,9 +27,9 @@ struct Anchor
if (!u.format.v.sanitize (c)) return_trace (false);
hb_barrier ();
switch (u.format.v) {
case 1: return_trace (u.format1.sanitize (c));
case 2: return_trace (u.format2.sanitize (c));
case 3: return_trace (u.format3.sanitize (c));
case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
default:return_trace (true);
}
}
@@ -39,9 +39,9 @@ struct Anchor
{
*x = *y = 0;
switch (u.format.v) {
case 1: u.format1.get_anchor (c, glyph_id, x, y); return;
case 2: u.format2.get_anchor (c, glyph_id, x, y); return;
case 3: u.format3.get_anchor (c, glyph_id, x, y); return;
case 1: hb_barrier (); u.format1.get_anchor (c, glyph_id, x, y); return;
case 2: hb_barrier (); u.format2.get_anchor (c, glyph_id, x, y); return;
case 3: hb_barrier (); u.format3.get_anchor (c, glyph_id, x, y); return;
default: return;
}
}
@@ -50,8 +50,9 @@ struct Anchor
{
TRACE_SUBSET (this);
switch (u.format.v) {
case 1: return_trace (bool (reinterpret_cast<Anchor *> (u.format1.copy (c->serializer))));
case 1: hb_barrier (); return_trace (bool (reinterpret_cast<Anchor *> (u.format1.copy (c->serializer))));
case 2:
hb_barrier ();
if (c->plan->flags & HB_SUBSET_FLAGS_NO_HINTING)
{
// AnchorFormat 2 just containins extra hinting information, so
@@ -59,7 +60,7 @@ struct Anchor
return_trace (bool (reinterpret_cast<Anchor *> (u.format1.copy (c->serializer))));
}
return_trace (bool (reinterpret_cast<Anchor *> (u.format2.copy (c->serializer))));
case 3: return_trace (u.format3.subset (c));
case 3: hb_barrier (); return_trace (u.format3.subset (c));
default:return_trace (false);
}
}
@@ -70,6 +71,7 @@ struct Anchor
case 1: case 2:
return;
case 3:
hb_barrier ();
u.format3.collect_variation_indices (c);
return;
default: return;
+1 -1
View File
@@ -22,7 +22,7 @@ struct CursivePos
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
default:return_trace (c->default_return_value ());
}
}
+2 -2
View File
@@ -25,9 +25,9 @@ struct MarkBasePos
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
#endif
default:return_trace (c->default_return_value ());
}
+2 -2
View File
@@ -25,9 +25,9 @@ struct MarkLigPos
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
#endif
default:return_trace (c->default_return_value ());
}
+2 -2
View File
@@ -25,9 +25,9 @@ struct MarkMarkPos
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
#endif
default:return_trace (c->default_return_value ());
}
+4 -4
View File
@@ -28,11 +28,11 @@ struct PairPos
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
#endif
default:return_trace (c->default_return_value ());
}
+9 -9
View File
@@ -37,15 +37,15 @@ struct PosLookupSubTable
{
TRACE_DISPATCH (this, lookup_type);
switch (lookup_type) {
case Single: return_trace (u.single.dispatch (c, std::forward<Ts> (ds)...));
case Pair: return_trace (u.pair.dispatch (c, std::forward<Ts> (ds)...));
case Cursive: return_trace (u.cursive.dispatch (c, std::forward<Ts> (ds)...));
case MarkBase: return_trace (u.markBase.dispatch (c, std::forward<Ts> (ds)...));
case MarkLig: return_trace (u.markLig.dispatch (c, std::forward<Ts> (ds)...));
case MarkMark: return_trace (u.markMark.dispatch (c, std::forward<Ts> (ds)...));
case Context: return_trace (u.context.dispatch (c, std::forward<Ts> (ds)...));
case ChainContext: return_trace (u.chainContext.dispatch (c, std::forward<Ts> (ds)...));
case Extension: return_trace (u.extension.dispatch (c, std::forward<Ts> (ds)...));
case Single: hb_barrier (); return_trace (u.single.dispatch (c, std::forward<Ts> (ds)...));
case Pair: hb_barrier (); return_trace (u.pair.dispatch (c, std::forward<Ts> (ds)...));
case Cursive: hb_barrier (); return_trace (u.cursive.dispatch (c, std::forward<Ts> (ds)...));
case MarkBase: hb_barrier (); return_trace (u.markBase.dispatch (c, std::forward<Ts> (ds)...));
case MarkLig: hb_barrier (); return_trace (u.markLig.dispatch (c, std::forward<Ts> (ds)...));
case MarkMark: hb_barrier (); return_trace (u.markMark.dispatch (c, std::forward<Ts> (ds)...));
case Context: hb_barrier (); return_trace (u.context.dispatch (c, std::forward<Ts> (ds)...));
case ChainContext: hb_barrier (); return_trace (u.chainContext.dispatch (c, std::forward<Ts> (ds)...));
case Extension: hb_barrier (); return_trace (u.extension.dispatch (c, std::forward<Ts> (ds)...));
default: return_trace (c->default_return_value ());
}
}
+4 -4
View File
@@ -51,13 +51,13 @@ struct SinglePos
u.format.v = format;
switch (u.format.v) {
case 1: u.format1.serialize (c,
case 1: hb_barrier (); u.format1.serialize (c,
src,
glyph_val_iter_pairs,
new_format,
layout_variation_idx_delta_map);
return;
case 2: u.format2.serialize (c,
case 2: hb_barrier (); u.format2.serialize (c,
src,
glyph_val_iter_pairs,
new_format,
@@ -73,8 +73,8 @@ struct SinglePos
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
default:return_trace (c->default_return_value ());
}
}
+3 -3
View File
@@ -26,9 +26,9 @@ struct AlternateSubst
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
#endif
default:return_trace (c->default_return_value ());
}
@@ -46,7 +46,7 @@ struct AlternateSubst
unsigned int format = 1;
u.format.v = format;
switch (u.format.v) {
case 1: return_trace (u.format1.serialize (c, glyphs, alternate_len_list, alternate_glyphs_list));
case 1: hb_barrier (); return_trace (u.format1.serialize (c, glyphs, alternate_len_list, alternate_glyphs_list));
default:return_trace (false);
}
}
+3 -3
View File
@@ -26,9 +26,9 @@ struct LigatureSubst
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
#endif
default:return_trace (c->default_return_value ());
}
@@ -49,7 +49,7 @@ struct LigatureSubst
unsigned int format = 1;
u.format.v = format;
switch (u.format.v) {
case 1: return_trace (u.format1.serialize (c,
case 1: hb_barrier (); return_trace (u.format1.serialize (c,
first_glyphs,
ligature_per_first_glyph_count_list,
ligatures_list,
+3 -3
View File
@@ -27,9 +27,9 @@ struct MultipleSubst
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
#endif
default:return_trace (c->default_return_value ());
}
@@ -45,7 +45,7 @@ struct MultipleSubst
unsigned int format = 1;
u.format.v = format;
switch (u.format.v) {
case 1: return_trace (u.format1.serialize (c, it));
case 1: hb_barrier (); return_trace (u.format1.serialize (c, it));
default:return_trace (false);
}
}
@@ -23,7 +23,7 @@ struct ReverseChainSingleSubst
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
default:return_trace (c->default_return_value ());
}
}
+8 -8
View File
@@ -30,11 +30,11 @@ struct SingleSubst
if (unlikely (!c->may_dispatch (this, &u.format.v))) return c->no_dispatch_return_value ();
TRACE_DISPATCH (this, u.format.v);
switch (u.format.v) {
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
#ifndef HB_NO_BEYOND_64K
case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
#endif
default:return_trace (c->default_return_value ());
}
@@ -73,17 +73,17 @@ struct SingleSubst
u.format.v = format;
switch (u.format.v) {
case 1: return_trace (u.format1.serialize (c,
case 1: hb_barrier (); return_trace (u.format1.serialize (c,
+ glyphs
| hb_map_retains_sorting (hb_first),
delta));
case 2: return_trace (u.format2.serialize (c, glyphs));
case 2: hb_barrier (); return_trace (u.format2.serialize (c, glyphs));
#ifndef HB_NO_BEYOND_64K
case 3: return_trace (u.format3.serialize (c,
case 3: hb_barrier (); return_trace (u.format3.serialize (c,
+ glyphs
| hb_map_retains_sorting (hb_first),
delta));
case 4: return_trace (u.format4.serialize (c, glyphs));
case 4: hb_barrier (); return_trace (u.format4.serialize (c, glyphs));
#endif
default:return_trace (false);
}
+1 -1
View File
@@ -24,7 +24,7 @@ struct SubstLookup : Lookup
bool is_reverse () const
{
unsigned int type = get_type ();
if (unlikely (type == SubTable::Extension))
if (unlikely (type == SubTable::Extension) && hb_barrier ())
return get_subtable (0).u.extension.is_reverse ();
return lookup_type_is_reverse (type);
}
+8 -8
View File
@@ -50,14 +50,14 @@ struct SubstLookupSubTable
{
TRACE_DISPATCH (this, lookup_type);
switch (lookup_type) {
case Single: return_trace (u.single.dispatch (c, std::forward<Ts> (ds)...));
case Multiple: return_trace (u.multiple.dispatch (c, std::forward<Ts> (ds)...));
case Alternate: return_trace (u.alternate.dispatch (c, std::forward<Ts> (ds)...));
case Ligature: return_trace (u.ligature.dispatch (c, std::forward<Ts> (ds)...));
case Context: return_trace (u.context.dispatch (c, std::forward<Ts> (ds)...));
case ChainContext: return_trace (u.chainContext.dispatch (c, std::forward<Ts> (ds)...));
case Extension: return_trace (u.extension.dispatch (c, std::forward<Ts> (ds)...));
case ReverseChainSingle: return_trace (u.reverseChainContextSingle.dispatch (c, std::forward<Ts> (ds)...));
case Single: hb_barrier (); return_trace (u.single.dispatch (c, std::forward<Ts> (ds)...));
case Multiple: hb_barrier (); return_trace (u.multiple.dispatch (c, std::forward<Ts> (ds)...));
case Alternate: hb_barrier (); return_trace (u.alternate.dispatch (c, std::forward<Ts> (ds)...));
case Ligature: hb_barrier (); return_trace (u.ligature.dispatch (c, std::forward<Ts> (ds)...));
case Context: hb_barrier (); return_trace (u.context.dispatch (c, std::forward<Ts> (ds)...));
case ChainContext: hb_barrier (); return_trace (u.chainContext.dispatch (c, std::forward<Ts> (ds)...));
case Extension: hb_barrier (); return_trace (u.extension.dispatch (c, std::forward<Ts> (ds)...));
case ReverseChainSingle: hb_barrier (); return_trace (u.reverseChainContextSingle.dispatch (c, std::forward<Ts> (ds)...));
default: return_trace (c->default_return_value ());
}
}
+2 -2
View File
@@ -414,9 +414,9 @@ struct GSTAR : public OT::GSUBGPOS
const void* get_lookup_list_field_offset () const
{
switch (u.version.major) {
case 1: return u.version1.get_lookup_list_offset ();
case 1: hb_barrier (); return u.version1.get_lookup_list_offset ();
#ifndef HB_NO_BEYOND_64K
case 2: return u.version2.get_lookup_list_offset ();
case 2: hb_barrier (); return u.version2.get_lookup_list_offset ();
#endif
default: return 0;
}
+2
View File
@@ -485,6 +485,7 @@ struct LigatureSubst : public OT::Layout::GSUB_impl::LigatureSubst
{
switch (u.format.v) {
case 1:
hb_barrier ();
return ((LigatureSubstFormat1*)(&u.format1))->split_subtables (c, this_index);
#ifndef HB_NO_BEYOND_64K
case 2: HB_FALLTHROUGH;
@@ -503,6 +504,7 @@ struct LigatureSubst : public OT::Layout::GSUB_impl::LigatureSubst
switch (u.format.v) {
case 1:
hb_barrier ();
return ((LigatureSubstFormat1*)(&u.format1))->sanitize (vertex);
#ifndef HB_NO_BEYOND_64K
case 2: HB_FALLTHROUGH;
+2
View File
@@ -480,6 +480,7 @@ struct MarkBasePos : public OT::Layout::GPOS_impl::MarkBasePos
{
switch (u.format.v) {
case 1:
hb_barrier ();
return ((MarkBasePosFormat1*)(&u.format1))->split_subtables (c, this_index);
#ifndef HB_NO_BEYOND_64K
case 2: HB_FALLTHROUGH;
@@ -498,6 +499,7 @@ struct MarkBasePos : public OT::Layout::GPOS_impl::MarkBasePos
switch (u.format.v) {
case 1:
hb_barrier ();
return ((MarkBasePosFormat1*)(&u.format1))->sanitize (vertex);
#ifndef HB_NO_BEYOND_64K
case 2: HB_FALLTHROUGH;
+4
View File
@@ -608,8 +608,10 @@ struct PairPos : public OT::Layout::GPOS_impl::PairPos
{
switch (u.format.v) {
case 1:
hb_barrier ();
return ((PairPosFormat1*)(&u.format1))->split_subtables (c, this_index);
case 2:
hb_barrier ();
return ((PairPosFormat2*)(&u.format2))->split_subtables (c, this_index);
#ifndef HB_NO_BEYOND_64K
case 3: HB_FALLTHROUGH;
@@ -629,8 +631,10 @@ struct PairPos : public OT::Layout::GPOS_impl::PairPos
switch (u.format.v) {
case 1:
hb_barrier ();
return ((PairPosFormat1*)(&u.format1))->sanitize (vertex);
case 2:
hb_barrier ();
return ((PairPosFormat2*)(&u.format2))->sanitize (vertex);
#ifndef HB_NO_BEYOND_64K
case 3: HB_FALLTHROUGH;
+4 -4
View File
@@ -127,10 +127,10 @@ struct bsln
switch (format)
{
case 0: return_trace (parts.format0.sanitize (c));
case 1: return_trace (parts.format1.sanitize (c));
case 2: return_trace (parts.format2.sanitize (c));
case 3: return_trace (parts.format3.sanitize (c));
case 0: hb_barrier (); return_trace (parts.format0.sanitize (c));
case 1: hb_barrier (); return_trace (parts.format1.sanitize (c));
case 2: hb_barrier (); return_trace (parts.format2.sanitize (c));
case 3: hb_barrier (); return_trace (parts.format3.sanitize (c));
default:return_trace (true);
}
}
+10 -10
View File
@@ -870,11 +870,11 @@ struct KerxSubTable
unsigned int subtable_type = get_type ();
TRACE_DISPATCH (this, subtable_type);
switch (subtable_type) {
case 0: return_trace (c->dispatch (u.format0, std::forward<Ts> (ds)...));
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 4: return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
case 6: return_trace (c->dispatch (u.format6, std::forward<Ts> (ds)...));
case 0: hb_barrier (); return_trace (c->dispatch (u.format0, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward<Ts> (ds)...));
case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward<Ts> (ds)...));
case 6: hb_barrier (); return_trace (c->dispatch (u.format6, std::forward<Ts> (ds)...));
default: return_trace (c->default_return_value ());
}
}
@@ -884,11 +884,11 @@ struct KerxSubTable
{
unsigned int subtable_type = get_type ();
switch (subtable_type) {
case 0: u.format0.collect_glyphs (first_set, second_set, num_glyphs); return;
case 1: u.format1.collect_glyphs (first_set, second_set, num_glyphs); return;
case 2: u.format2.collect_glyphs (first_set, second_set, num_glyphs); return;
case 4: u.format4.collect_glyphs (first_set, second_set, num_glyphs); return;
case 6: u.format6.collect_glyphs (first_set, second_set, num_glyphs); return;
case 0: hb_barrier (); u.format0.collect_glyphs (first_set, second_set, num_glyphs); return;
case 1: hb_barrier (); u.format1.collect_glyphs (first_set, second_set, num_glyphs); return;
case 2: hb_barrier (); u.format2.collect_glyphs (first_set, second_set, num_glyphs); return;
case 4: hb_barrier (); u.format4.collect_glyphs (first_set, second_set, num_glyphs); return;
case 6: hb_barrier (); u.format6.collect_glyphs (first_set, second_set, num_glyphs); return;
default: return;
}
}
+5 -5
View File
@@ -1078,11 +1078,11 @@ struct ChainSubtable
unsigned int subtable_type = get_type ();
TRACE_DISPATCH (this, subtable_type);
switch (subtable_type) {
case Rearrangement: return_trace (c->dispatch (u.rearrangement, std::forward<Ts> (ds)...));
case Contextual: return_trace (c->dispatch (u.contextual, std::forward<Ts> (ds)...));
case Ligature: return_trace (c->dispatch (u.ligature, std::forward<Ts> (ds)...));
case Noncontextual: return_trace (c->dispatch (u.noncontextual, std::forward<Ts> (ds)...));
case Insertion: return_trace (c->dispatch (u.insertion, std::forward<Ts> (ds)...));
case Rearrangement: hb_barrier (); return_trace (c->dispatch (u.rearrangement, std::forward<Ts> (ds)...));
case Contextual: hb_barrier (); return_trace (c->dispatch (u.contextual, std::forward<Ts> (ds)...));
case Ligature: hb_barrier (); return_trace (c->dispatch (u.ligature, std::forward<Ts> (ds)...));
case Noncontextual: hb_barrier (); return_trace (c->dispatch (u.noncontextual, std::forward<Ts> (ds)...));
case Insertion: hb_barrier (); return_trace (c->dispatch (u.insertion, std::forward<Ts> (ds)...));
default: return_trace (c->default_return_value ());
}
}
+8 -8
View File
@@ -474,8 +474,8 @@ struct OpenTypeFontFile
case TrueTag:
case Typ1Tag:
case TrueTypeTag: return 1;
case TTCTag: return u.ttcHeader.get_face_count ();
case DFontTag: return u.rfHeader.get_face_count ();
case TTCTag: hb_barrier (); return u.ttcHeader.get_face_count ();
case DFontTag: hb_barrier (); return u.rfHeader.get_face_count ();
default: return 0;
}
}
@@ -490,9 +490,9 @@ struct OpenTypeFontFile
case CFFTag: /* All the non-collection tags */
case TrueTag:
case Typ1Tag:
case TrueTypeTag: return u.fontFace;
case TTCTag: return u.ttcHeader.get_face (i);
case DFontTag: return u.rfHeader.get_face (i, base_offset);
case TrueTypeTag: hb_barrier (); return u.fontFace;
case TTCTag: hb_barrier (); return u.ttcHeader.get_face (i);
case DFontTag: hb_barrier (); return u.rfHeader.get_face (i, base_offset);
default: return Null (OpenTypeFontFace);
}
}
@@ -518,9 +518,9 @@ struct OpenTypeFontFile
case CFFTag: /* All the non-collection tags */
case TrueTag:
case Typ1Tag:
case TrueTypeTag: return_trace (u.fontFace.sanitize (c));
case TTCTag: return_trace (u.ttcHeader.sanitize (c));
case DFontTag: return_trace (u.rfHeader.sanitize (c));
case TrueTypeTag: hb_barrier (); return_trace (u.fontFace.sanitize (c));
case TTCTag: hb_barrier (); return_trace (u.ttcHeader.sanitize (c));
case DFontTag: hb_barrier (); return_trace (u.rfHeader.sanitize (c));
default: return_trace (true);
}
}
+2 -1
View File
@@ -2059,7 +2059,7 @@ struct cmap
this->subtable_uvs = &Null (CmapSubtableFormat14);
{
const CmapSubtable *st = table->find_subtable (0, 5);
if (st && st->u.format.v == 14)
if (st && st->u.format.v == 14 && hb_barrier ())
subtable_uvs = &st->u.format14;
}
@@ -2141,6 +2141,7 @@ struct cmap
break;
case 4:
{
hb_barrier ();
this->format4_accel.init (&subtable->u.format4,
get_subtable_data_size (subtable));
this->get_glyph_data = &this->format4_accel;
+10 -10
View File
@@ -144,13 +144,13 @@ struct KernSubTable
unsigned int subtable_type = get_type ();
TRACE_DISPATCH (this, subtable_type);
switch (subtable_type) {
case 0: return_trace (c->dispatch (u.format0));
case 0: hb_barrier (); return_trace (c->dispatch (u.format0));
#ifndef HB_NO_AAT_SHAPE
case 1: return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward<Ts> (ds)...));
#endif
case 2: return_trace (c->dispatch (u.format2));
case 2: hb_barrier (); return_trace (c->dispatch (u.format2));
#ifndef HB_NO_AAT_SHAPE
case 3: return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward<Ts> (ds)...));
#endif
default: return_trace (c->default_return_value ());
}
@@ -161,10 +161,10 @@ struct KernSubTable
{
unsigned int subtable_type = get_type ();
switch (subtable_type) {
case 0: u.format0.collect_glyphs (left_set, right_set, num_glyphs); return;
case 1: u.format1.collect_glyphs (left_set, right_set, num_glyphs); return;
case 2: u.format2.collect_glyphs (left_set, right_set, num_glyphs); return;
case 3: u.format3.collect_glyphs (left_set, right_set, num_glyphs); return;
case 0: hb_barrier (); u.format0.collect_glyphs (left_set, right_set, num_glyphs); return;
case 1: hb_barrier (); u.format1.collect_glyphs (left_set, right_set, num_glyphs); return;
case 2: hb_barrier (); u.format2.collect_glyphs (left_set, right_set, num_glyphs); return;
case 3: hb_barrier (); u.format3.collect_glyphs (left_set, right_set, num_glyphs); return;
default: return;
}
}
@@ -352,9 +352,9 @@ struct kern
unsigned int subtable_type = get_type ();
TRACE_DISPATCH (this, subtable_type);
switch (subtable_type) {
case 0: return_trace (c->dispatch (u.ot, std::forward<Ts> (ds)...));
case 0: hb_barrier (); return_trace (c->dispatch (u.ot, std::forward<Ts> (ds)...));
#ifndef HB_NO_AAT_SHAPE
case 1: return_trace (c->dispatch (u.aat, std::forward<Ts> (ds)...));
case 1: hb_barrier (); return_trace (c->dispatch (u.aat, std::forward<Ts> (ds)...));
#endif
default: return_trace (c->default_return_value ());
}
+14 -4
View File
@@ -706,7 +706,7 @@ struct FeatureParams
return true;
#endif
TRACE_SANITIZE (this);
if (tag == HB_TAG ('s','i','z','e'))
if (tag == HB_TAG ('s','i','z','e') && hb_barrier ())
return_trace (u.size.sanitize (c));
if ((tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
return_trace (u.stylisticSet.sanitize (c));
@@ -720,7 +720,7 @@ struct FeatureParams
#ifdef HB_NO_LAYOUT_FEATURE_PARAMS
return;
#endif
if (tag == HB_TAG ('s','i','z','e'))
if (tag == HB_TAG ('s','i','z','e') && hb_barrier ())
return (u.size.collect_name_ids (nameids_to_retain));
if ((tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
return (u.stylisticSet.collect_name_ids (nameids_to_retain));
@@ -732,7 +732,7 @@ struct FeatureParams
{
TRACE_SUBSET (this);
if (!tag) return_trace (false);
if (*tag == HB_TAG ('s','i','z','e'))
if (*tag == HB_TAG ('s','i','z','e') && hb_barrier ())
return_trace (u.size.subset (c));
if ((*tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
return_trace (u.stylisticSet.subset (c));
@@ -744,7 +744,7 @@ struct FeatureParams
#ifndef HB_NO_LAYOUT_FEATURE_PARAMS
const FeatureParamsSize& get_size_params (hb_tag_t tag) const
{
if (tag == HB_TAG ('s','i','z','e'))
if (tag == HB_TAG ('s','i','z','e') && hb_barrier ())
return u.size;
return Null (FeatureParamsSize);
}
@@ -4955,10 +4955,12 @@ struct Device
{
#ifndef HB_NO_HINTING
case 1: case 2: case 3:
hb_barrier ();
return u.hinting.get_x_delta (font);
#endif
#ifndef HB_NO_VAR
case 0x8000:
hb_barrier ();
return u.variation.get_x_delta (font, store, store_cache);
#endif
default:
@@ -4973,10 +4975,12 @@ struct Device
{
case 1: case 2: case 3:
#ifndef HB_NO_HINTING
hb_barrier ();
return u.hinting.get_y_delta (font);
#endif
#ifndef HB_NO_VAR
case 0x8000:
hb_barrier ();
return u.variation.get_y_delta (font, store, store_cache);
#endif
default:
@@ -4991,10 +4995,12 @@ struct Device
switch (u.b.format) {
#ifndef HB_NO_HINTING
case 1: case 2: case 3:
hb_barrier ();
return_trace (u.hinting.sanitize (c));
#endif
#ifndef HB_NO_VAR
case 0x8000:
hb_barrier ();
return_trace (u.variation.sanitize (c));
#endif
default:
@@ -5011,10 +5017,12 @@ struct Device
case 1:
case 2:
case 3:
hb_barrier ();
return_trace (reinterpret_cast<Device *> (u.hinting.copy (c)));
#endif
#ifndef HB_NO_VAR
case 0x8000:
hb_barrier ();
return_trace (reinterpret_cast<Device *> (u.variation.copy (c, layout_variation_idx_delta_map)));
#endif
default:
@@ -5033,6 +5041,7 @@ struct Device
#endif
#ifndef HB_NO_VAR
case 0x8000:
hb_barrier ();
u.variation.collect_variation_index (c);
return;
#endif
@@ -5046,6 +5055,7 @@ struct Device
switch (u.b.format) {
#ifndef HB_NO_VAR
case 0x8000:
hb_barrier ();
return u.variation.varIdx;
#endif
default:
+44
View File
@@ -27,8 +27,49 @@
#include <hb.h>
#include <hb-ot.h>
#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MPROTECT) && defined(HAVE_MMAP)
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/mman.h>
#endif
#define STATIC_ARRAY_SIZE 255
#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MPROTECT) && defined(HAVE_MMAP)
static void
test_ot_layout_gdef_unsupported_version (void)
{
const char gdef[] = {0x87, 0x00, 0x00, 0x06, 0x30};
long pagesize = sysconf (_SC_PAGESIZE);
char *mapping;
char *table;
hb_blob_t *blob;
hb_face_t *face;
g_assert_cmpint (pagesize, >, 0);
mapping = mmap (NULL, 2 * pagesize, PROT_NONE,
MAP_PRIVATE | MAP_ANON, -1, 0);
g_assert_true (mapping != MAP_FAILED);
g_assert_cmpint (mprotect (mapping, pagesize, PROT_READ | PROT_WRITE), ==, 0);
table = mapping + pagesize - sizeof (gdef);
memcpy (table, gdef, sizeof (gdef));
g_assert_cmpint (mprotect (mapping, pagesize, PROT_READ), ==, 0);
face = hb_face_builder_create ();
blob = hb_blob_create (table, sizeof (gdef), HB_MEMORY_MODE_READONLY,
NULL, NULL);
g_assert_true (hb_face_builder_add_table (face, HB_OT_TAG_GDEF, blob));
hb_blob_destroy (blob);
g_assert_false (hb_ot_layout_has_glyph_classes (face));
hb_face_destroy (face);
g_assert_cmpint (munmap (mapping, 2 * pagesize), ==, 0);
}
#endif
static void
test_ot_layout_table_get_script_tags (void)
{
@@ -219,6 +260,9 @@ int
main (int argc, char **argv)
{
hb_test_init (&argc, &argv);
#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MPROTECT) && defined(HAVE_MMAP)
hb_test_add (test_ot_layout_gdef_unsupported_version);
#endif
hb_test_add (test_ot_layout_table_get_script_tags);
hb_test_add (test_ot_layout_table_find_script);
hb_test_add (test_ot_layout_script_get_language_tags);