From 07cabf6e5b3ff997e060cc5df6910f1814b4e5a8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 9 Nov 2026 20:26:42 -0600 Subject: [PATCH] [aat] Drop the per-subtable buffer-pass charge to max_ops (#6605) charge_buffer_pass() debited buffer->len from max_ops before every kerx/kern/morx subtable that applies. It mostly duplicates the HB_AAT_MAX_SUBTABLES (1024) sanitize cap, which already bounds the number of passes per table, and it charged the length of a buffer that morx may have grown against an allowance sized from the input length. Remove it and its two call sites. The kerx loop still stops once the buffer is no longer successful. The subtable-limit API tests are kept; they test the sanitize cap, not the charge. Testing: meson test -C build (all passing). Follow-up to #6513 Co-authored-by: Claude Opus 5.5 --- src/hb-aat-layout-common.hh | 13 ------------- src/hb-aat-layout-kerx-table.hh | 3 --- src/hb-aat-layout-morx-table.hh | 3 --- 3 files changed, 19 deletions(-) diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 119a5cb9e..7a26e3cc9 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -155,19 +155,6 @@ struct hb_aat_apply_context_t : buffer_is_reversed = !buffer_is_reversed; } - /* Applying a subtable walks the whole buffer. The font controls the - * number of subtables, so charge each pass to the buffer's work budget. */ - HB_NODISCARD bool charge_buffer_pass () - { - buffer->max_ops -= buffer->len; - if (unlikely (buffer->max_ops < 0)) - { - buffer->successful = false; - return false; - } - return true; - } - void setup_buffer_glyph_set () { using_buffer_glyph_set = buffer->len >= 4 && buffer_glyph_set; diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index c4f662daa..b061c2c25 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -1114,9 +1114,6 @@ struct KerxTable reverse = bool (st->u.header.coverage & st->u.header.Backwards) != HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction); - if (unlikely (!c->charge_buffer_pass ())) - break; - if (!c->buffer->message (c->font, "start subtable %u", c->lookup_index)) goto skip; diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index aef11ddff..c3aa4380c 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -1270,9 +1270,6 @@ struct Chain bool (coverage & ChainSubtable::Backwards) != HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction); - if (unlikely (!c->charge_buffer_pass ())) - break; - if (!c->buffer->message (c->font, "start chainsubtable %u", c->lookup_index)) goto skip;