From d74dc3ef65a159fe585e906deccdb32b570433aa Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 30 Mar 2019 19:26:37 -0700 Subject: [PATCH] [serialize] Don't insert empty object into tree --- src/hb-serialize.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hb-serialize.hh b/src/hb-serialize.hh index e7873ab69..3bbff7541 100644 --- a/src/hb-serialize.hh +++ b/src/hb-serialize.hh @@ -160,6 +160,9 @@ struct hb_serialize_context_t memmove (tail, obj.head, len); head = obj.head; + if (!len) + return 0; + obj.head = tail; obj.tail = tail + len; @@ -304,7 +307,7 @@ struct hb_serialize_context_t hb_vector_t packed; /* Map view of packed objects. */ - hb_hashmap_t packed_map; + hb_hashmap_t packed_map; };