Guard VarData itemCount overflow (#5836)

Reject oversized merged VarData row sets before assigning them to the
16-bit itemCount field. This avoids truncating the serialized allocation
size and prevents the subsequent row write loop from running out of
bounds.

 src/hb-ot-layout-common.hh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Co-authored-by: Quang Luong <oss@engineer.ink>
This commit is contained in:
Behdad EsfahbodandQuang Luong authored and GitHub committed 2026-03-12 08:57:35 -06:00
1 parent 283b568114
commit 91085cd990
1 file changed
+3 -1
+3 -1
View File
@@ -2971,7 +2971,9 @@ struct VarData
}
if (unlikely (!c->extend_min (this))) return_trace (false);
itemCount = row_count;
if (unlikely (!c->check_assign (itemCount, row_count,
HB_SERIALIZE_ERROR_INT_OVERFLOW)))
return_trace (false);
int min_threshold = has_long ? -65536 : -128;
int max_threshold = has_long ? +65535 : +127;