From fc62af31c38fabe17de5dfd50deccec6c80e88f9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 30 Jan 2025 05:03:34 +0000 Subject: [PATCH] [hvgl] Bail on error Easier than handling a vector too short. --- src/hb-aat-var-hvgl-table.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hb-aat-var-hvgl-table.cc b/src/hb-aat-var-hvgl-table.cc index 0968c073a..f5e2a9192 100644 --- a/src/hb-aat-var-hvgl-table.cc +++ b/src/hb-aat-var-hvgl-table.cc @@ -107,6 +107,9 @@ PartShape::get_path_at (const struct hvgl &hvgl, else v = a; + if (unlikely (v.in_error ())) + return; + coords = coords.sub_array (0, axisCount); // Apply deltas if (coords) @@ -159,7 +162,7 @@ PartShape::get_path_at (const struct hvgl &hvgl, const auto delta2 = matrix + column_idx[2] * rows_count; const auto delta3 = matrix + column_idx[3] * rows_count; - // Note: Count is always a multiple of 4, unless allocation failure + // Note: Count is always a multiple of 4 for (unsigned i = 0; i + 4 <= rows_count; i += 4) { const auto &src0 = * (const simd_packed_double4 *) (void *) (delta0 + i); @@ -193,7 +196,7 @@ PartShape::get_path_at (const struct hvgl &hvgl, dest[i + 2] += src[i + 2] * scalar; dest[i + 3] += src[i + 3] * scalar; } - // Note: Count is always a multiple of 4, unless allocation failure. + // Note: Count is always a multiple of 4 // So, the following not needed. if (false) for (; i < rows_count; i++)