From 5e241094bfa72840a4142c33264d128b60f12330 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Fri, 29 Apr 2022 22:44:43 +0000 Subject: [PATCH] [subset] In unicodes cache cleanup if set insert fails. --- src/hb-ot-cmap-table.hh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 0967e6381..3d2fb373f 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -1471,7 +1471,11 @@ struct SubtableUnicodesCache { hb_set_t* set_for(const EncodingRecord* record) { if (!cached_unicodes.has ((intptr_t) record)) { - cached_unicodes.set ((intptr_t) record, hb_set_create ()); + hb_set_t* new_set = hb_set_create (); + if (!cached_unicodes.set ((intptr_t) record, new_set)) { + hb_set_destroy (new_set); + return hb_set_empty (); + } (base+record->subtable).collect_unicodes (cached_unicodes.get ((intptr_t) record)); } return cached_unicodes.get ((intptr_t) record);