From 39754fb65981fa8d11615e1dced852285ad09e4e Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Mon, 16 Apr 2018 15:09:27 -0700 Subject: [PATCH] [subset] Don't assume the last segment in cmap 4 can be skipped, actually check it. --- src/hb-ot-cmap-table.hh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index f94dc0687..c7c5d0a97 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -130,8 +130,12 @@ struct CmapSubtableFormat4 static inline void get_all_codepoints_func (const void *obj, hb_set_t *out) { const accelerator_t *thiz = (const accelerator_t *) obj; - for (unsigned int i = 0; i < thiz->segCount - 1; i++) // Skip the last segment (0xFFFF) - hb_set_add_range (out, thiz->startCount[i], thiz->endCount[i]); + for (unsigned int i = 0; i < thiz->segCount; i++) + { + if (thiz->startCount[i] != 0xFFFFu + || thiz->endCount[i] != 0xFFFFu) // Skip the last segment (0xFFFF) + hb_set_add_range (out, thiz->startCount[i], thiz->endCount[i]); + } } const HBUINT16 *endCount;