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)