From 5f61ccf07d5f0b777c290df4413ae2c7bdb08fd5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 13 Mar 2025 13:22:28 -0600 Subject: [PATCH] [set] Fix reallocation Was shrinking malloced vectors inadverently. --- src/hb-bit-set.hh | 2 +- src/hb-vector.hh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hb-bit-set.hh b/src/hb-bit-set.hh index 251e6eba2..ec462c7d4 100644 --- a/src/hb-bit-set.hh +++ b/src/hb-bit-set.hh @@ -88,7 +88,7 @@ struct hb_bit_set_t { if (unlikely (!successful)) return false; - if (pages.length < count && count <= 2) + if (pages.length < count && (unsigned) pages.allocated < count && count <= 2) exact_size = true; // Most sets are small and local if (unlikely (!pages.resize (count, clear, exact_size) || diff --git a/src/hb-vector.hh b/src/hb-vector.hh index af9a1c750..2c1344c03 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -442,7 +442,6 @@ struct hb_vector_t new_allocated += (new_allocated >> 1) + 8; } - /* Reallocate */ bool overflows =