diff --git a/src/graph/graph.hh b/src/graph/graph.hh index a5ff77bbc..787c6f221 100644 --- a/src/graph/graph.hh +++ b/src/graph/graph.hh @@ -1250,8 +1250,8 @@ struct graph_t vertices_[l.objidx].add_parent (clone_idx, true); } - check_success (!clone->obj.real_links.in_error ()); - check_success (!clone->obj.virtual_links.in_error ()); + if (unlikely (!check_success (!clone->obj.real_links.in_error ()))) return HB_GRAPH_INVALID; + if (unlikely (!check_success (!clone->obj.virtual_links.in_error ()))) return HB_GRAPH_INVALID; return clone_idx; } @@ -1721,7 +1721,9 @@ struct graph_t queue.insert (0, root_idx ()); hb_vector_t visited; - visited.resize (vertices_.length); + if (unlikely (!check_success (visited.resize (vertices_.length)))) { + return; + } while (!queue.in_error () && !queue.is_empty ()) { diff --git a/src/graph/serialize.hh b/src/graph/serialize.hh index a9c7a12ec..6723150b5 100644 --- a/src/graph/serialize.hh +++ b/src/graph/serialize.hh @@ -252,7 +252,11 @@ inline hb_blob_t* serialize (const graph_t& graph) // Maps from our obj id's to the id's used during this serialization. hb_vector_t id_map; - id_map.resize(graph.ordering_.length); + if (!id_map.resize(graph.ordering_.length)) { + DEBUG_MSG (SUBSET_REPACK, nullptr, "Unable to allocate id_map buffer."); + return nullptr; + } + for (int pos = graph.ordering_.length - 1; pos >= 0; pos--) { unsigned i = graph.ordering_[pos]; c.push ();