In OT::VarData::Serialize don't attempt to serialize an empty set of rows.

Protects against incorrectly accessing rows[0] when rows is empty.
This commit is contained in:
Garret Rieger 2025-04-07 18:39:21 +00:00 committed by Behdad Esfahbod
parent 6dff699f3f
commit b1a0a4c228

View file

@ -2863,8 +2863,13 @@ struct VarData
const hb_vector_t<const hb_vector_t<int>*>& rows)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (this))) return_trace (false);
unsigned row_count = rows.length;
if (!row_count) {
// Nothing to serialize, will be empty.
return false;
}
if (unlikely (!c->extend_min (this))) return_trace (false);
itemCount = row_count;
int min_threshold = has_long ? -65536 : -128;