Avoid crash inside CFCharacterSetIsLongCharacterMember

* src/macfont.m (macfont_supports_charset_and_languages_p)
(macfont_has_char): Don't pass integers outside the Unicode codespace to
CFCharacterSetIsLongCharacterMember.
This commit is contained in:
YAMAMOTO Mitsuharu 2019-07-06 14:08:47 +09:00
parent dde0320020
commit 0e15bd11dc

View file

@ -2076,7 +2076,7 @@ static int macfont_variation_glyphs (struct font *, int c,
ptrdiff_t j;
for (j = 0; j < ASIZE (chars); j++)
if (TYPE_RANGED_FIXNUMP (UTF32Char, AREF (chars, j))
if (RANGED_FIXNUMP (0, AREF (chars, j), MAX_UNICODE_CHAR)
&& CFCharacterSetIsLongCharacterMember (desc_charset,
XFIXNAT (AREF (chars, j))))
break;
@ -2710,6 +2710,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))
{