[GPOS] Charge zero-size ValueRecord arrays to the sanitizer op budget

When a ValueFormat is empty its records take no bytes, so
ValueFormat::sanitize_values() and PairPosFormat2::sanitize() pass
check_range() without charging max_ops for the records, while later
code (the subsetter, variation-index collection) still walks count
records.  A tiny table can thus declare a huge valueCount / class
matrix and cost the subsetter CPU out of proportion to its size.

Charge count ops when the record size / stride is zero, following the
918193ebf precedent.  Adds two fuzzer regression fonts.

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-HFGOLC64.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Behdad EsfahbodandClaude Opus 4.8 committed 2026-11-10 19:23:24 -06:00
1 parent 1a3a6d2446
commit 25bf796716
3 files changed
+11

No files matched your search

+5
View File
@@ -182,6 +182,11 @@ struct PairPosFormat2_4 : ValueBase
return_trace (c->check_range ((const void *) values,
count,
stride) &&
/* Records of two empty ValueFormats take no bytes, so the
* range check neither bounds count nor charges for it.
* Manually modify the sanitizer max ops to take this into
* account. */
(likely (stride) || c->check_ops (count)) &&
(c->lazy_some_gpos ||
(valueFormat1.sanitize_values_stride_unsafe (c, this, &values[0], count, stride) &&
valueFormat2.sanitize_values_stride_unsafe (c, this, &values[len1], count, stride))));
+6
View File
@@ -415,6 +415,12 @@ struct ValueFormat : HBUINT16
if (!c->check_range (values, count, size)) return_trace (false);
/* Records of an empty ValueFormat take no bytes, so the range check
* neither bounds count nor charges for it, while later code (eg. the
* subsetter) still walks count records. Manually modify the sanitizer
* max ops to take this into account. */
if (unlikely (!size && !c->check_ops (count))) return_trace (false);
if (c->lazy_some_gpos)
return_trace (true);