diff --git a/src/graph/serialize.hh b/src/graph/serialize.hh index 37fac8909..4f89f1011 100644 --- a/src/graph/serialize.hh +++ b/src/graph/serialize.hh @@ -108,7 +108,7 @@ inline bool will_overflow (graph_t& graph, hb_vector_t* overflows = nullptr) { - if (overflows) overflows->resize (0); + if (overflows) overflows->clear (); graph.update_positions (); hb_hashmap_t record_set; diff --git a/src/hb-bit-set.hh b/src/hb-bit-set.hh index 05725048c..0d612438d 100644 --- a/src/hb-bit-set.hh +++ b/src/hb-bit-set.hh @@ -117,9 +117,11 @@ struct hb_bit_set_t void clear () { - resize (0); - if (likely (successful)) - population = 0; + /* Always zero length and population, even when in error state, + * so a stale set can't leak pages into a subsequent reuse. */ + pages.clear (); + page_map.clear (); + population = 0; } bool is_empty () const {