提交 148ca610 编写于 作者: B Bruce Mitchener 提交者: Behdad Esfahbod

[ot-layout] Fix nullptr dereference.

If the `calloc` for `gsub_accels` or `gpos_accels` fails, then the
unlikely branch afterwards can be taken, which frees up the
`hb_ot_layout_t`, but since those fields can now be `nullptr`, then
we don't want to dereference them.
上级 0c66043a
...@@ -195,10 +195,12 @@ _hb_ot_layout_create (hb_face_t *face) ...@@ -195,10 +195,12 @@ _hb_ot_layout_create (hb_face_t *face)
void void
_hb_ot_layout_destroy (hb_ot_layout_t *layout) _hb_ot_layout_destroy (hb_ot_layout_t *layout)
{ {
for (unsigned int i = 0; i < layout->gsub_lookup_count; i++) if (layout->gsub_accels)
layout->gsub_accels[i].fini (); for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
for (unsigned int i = 0; i < layout->gpos_lookup_count; i++) layout->gsub_accels[i].fini ();
layout->gpos_accels[i].fini (); if (layout->gpos_accels)
for (unsigned int i = 0; i < layout->gpos_lookup_count; i++)
layout->gpos_accels[i].fini ();
free (layout->gsub_accels); free (layout->gsub_accels);
free (layout->gpos_accels); free (layout->gpos_accels);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册