diff --git a/src/macfont.m b/src/macfont.m index 7f153e13045..c9321a7d22e 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -2070,7 +2070,7 @@ static int macfont_variation_glyphs (struct font *, int c, ptrdiff_t j; for (j = 0; j < ASIZE (chars); j++) - if (TYPE_RANGED_INTEGERP (UTF32Char, AREF (chars, j)) + if (RANGED_INTEGERP (0, AREF (chars, j), MAX_UNICODE_CHAR) && CFCharacterSetIsLongCharacterMember (desc_charset, XFASTINT (AREF (chars, j)))) break; @@ -2705,6 +2705,9 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no int result; CFCharacterSetRef charset; + if (c < 0 || c > MAX_UNICODE_CHAR) + return false; + block_input (); if (FONT_ENTITY_P (font)) {