From 3c080a7a0aefec1e9620e3fb399ad280ea4ee5a2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 7 Mar 2017 18:13:28 -0800 Subject: [PATCH] Fix buffer serialize of empty buffer Ouch! --- src/hb-buffer-serialize.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hb-buffer-serialize.cc b/src/hb-buffer-serialize.cc index 63a0f3466..85696c589 100644 --- a/src/hb-buffer-serialize.cc +++ b/src/hb-buffer-serialize.cc @@ -311,6 +311,8 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer, if (!buf_consumed) buf_consumed = &sconsumed; *buf_consumed = 0; + if (buf_size) + *buf = '\0'; assert ((!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID) || buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS);