From 094f80738a57a99a9f541f55bbf8aa796235756c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 23 Nov 2022 22:03:26 -0700 Subject: [PATCH] [buffer] Handle null buffer in set_message_func --- src/hb-buffer.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 9e67e680c..e827e9eb9 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -2150,6 +2150,13 @@ hb_buffer_set_message_func (hb_buffer_t *buffer, hb_buffer_message_func_t func, void *user_data, hb_destroy_func_t destroy) { + if (unlikely (hb_object_is_immutable (buffer))) + { + if (destroy) + destroy (user_data); + return; + } + if (buffer->message_destroy) buffer->message_destroy (buffer->message_data);