From 0dcdbb4f422c5f88eb9b4d1797311c92fdc3d7ea Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 6 Feb 2024 16:23:48 -0700 Subject: [PATCH] [VARC] Add consume_all to unpack_deltas() Untested. --- src/hb-ot-var-common.hh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-var-common.hh b/src/hb-ot-var-common.hh index 30b6c1a7e..14e4f86b7 100644 --- a/src/hb-ot-var-common.hh +++ b/src/hb-ot-var-common.hh @@ -1861,15 +1861,18 @@ struct TupleVariationData static bool unpack_deltas (const HBUINT8 *&p /* IN/OUT */, hb_vector_t &deltas /* IN/OUT */, - const HBUINT8 *end) + const HBUINT8 *end, + bool consume_all = false) { unsigned i = 0; - unsigned count = deltas.length; + unsigned count = consume_all ? UINT_MAX : deltas.length; while (i < count) { - if (unlikely (p + 1 > end)) return false; + if (unlikely (p + 1 > end)) return consume_all; unsigned control = *p++; unsigned run_count = (control & DELTA_RUN_COUNT_MASK) + 1; + if (consume_all) + deltas.resize (deltas.length + run_count, false); unsigned stop = i + run_count; if (unlikely (stop > count)) return false; if ((control & DELTAS_SIZE_MASK) == DELTAS_ARE_ZERO)