diff --git a/src/hb-serialize.hh b/src/hb-serialize.hh index d6aa58405..2f23b5853 100644 --- a/src/hb-serialize.hh +++ b/src/hb-serialize.hh @@ -547,6 +547,8 @@ struct hb_serialize_context_t unsigned int len = (this->head - this->start) + (this->end - this->tail); + if (!len) return hb_bytes_t (); + char *p = (char *) malloc (len); if (unlikely (!p)) return hb_bytes_t (); diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5269686781607936 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5269686781607936 new file mode 100644 index 000000000..5c0ad795f Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5269686781607936 differ