[subset] bound cvar tuple data length in calculate_cvt_deltas

This commit is contained in:
Nussu06 authored and Behdad Esfahbod committed 2026-07-18 07:25:19 -06:00
1 parent 9de7e9d563
commit 1737bce456
2 files changed
+11 -2

No files matched your search

+11 -2
View File
@@ -79,12 +79,12 @@ struct cvar
unsigned num_cvt_item,
const TupleVariationData<> *tuple_var_data,
const void *base,
unsigned var_data_length,
hb_vector_t<float>& cvt_deltas /* OUT */)
{
if (!coords) return true;
hb_vector_t<unsigned> shared_indices;
TupleVariationData<>::tuple_iterator_t iterator;
unsigned var_data_length = tuple_var_data->get_size (axis_count * 2);
hb_bytes_t var_data_bytes = hb_bytes_t (reinterpret_cast<const char*> (tuple_var_data), var_data_length);
if (!TupleVariationData<>::get_tuple_iterator (var_data_bytes, axis_count, base,
shared_indices, &iterator))
@@ -191,8 +191,17 @@ struct cvar
return false;
}
/* Bound the tuple variation data by the actual cvar table length rather
* than trusting tupleVarCount to walk the headers; an inflated count would
* otherwise run get_size() off the end of the table. */
hb_blob_t *cvar_blob = hb_face_reference_table (plan->source, cvar::tableTag);
unsigned cvar_length = hb_blob_get_length (cvar_blob);
hb_blob_destroy (cvar_blob);
unsigned var_data_offset = (unsigned) ((const char *) tuple_var_data - (const char *) base);
unsigned var_data_length = var_data_offset < cvar_length ? cvar_length - var_data_offset : 0;
if (!calculate_cvt_deltas (plan->normalized_coords.length, plan->normalized_coords.as_array (),
num_cvt_item, tuple_var_data, base, cvt_deltas))
num_cvt_item, tuple_var_data, base, var_data_length, cvt_deltas))
{
hb_blob_destroy (cvt_prime_blob);
return false;