[buffer] Fix invalid write access in hb_buffer_deserialize_glyphs()

If buffer is immutable, we were trying to set content_type on it.
Ouch!
This commit is contained in:
Behdad Esfahbod 2020-09-21 16:50:11 -06:00
parent 18b8046c6a
commit a1f4d285e1
1 changed files with 6 additions and 0 deletions

View File

@ -437,6 +437,12 @@ hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
assert ((!buffer->len && (buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)) ||
(buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS));
if (unlikely (hb_object_is_immutable (buffer)))
{
*end_ptr = buf;
return false;
}
if (buf_len == -1)
buf_len = strlen (buf);