summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2019-07-06 14:24:34 +0900
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2019-07-06 14:24:34 +0900
commitf0db687a28546b85a70fea1ce3b1fd4186693e70 (patch)
tree7cab7ed643b7bf41a78a57758950359dc6d62232
parente97c0437aa135f9580cd8cc1ec912758e3610ab1 (diff)
downloademacs-f0db687a28546b85a70fea1ce3b1fd4186693e70.tar.gz
Avoid crash inside CFCharacterSetIsLongCharacterMember (Bug#36507)
* src/macfont.m (macfont_supports_charset_and_languages_p) (macfont_has_char): Don't pass integers outside the Unicode codespace to CFCharacterSetIsLongCharacterMember. Do not merge to master.
-rw-r--r--src/macfont.m5
1 files changed, 4 insertions, 1 deletions
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 @@ macfont_supports_charset_and_languages_p (CTFontDescriptorRef desc,
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 @@ macfont_has_char (Lisp_Object font, int c)
int result;
CFCharacterSetRef charset;
+ if (c < 0 || c > MAX_UNICODE_CHAR)
+ return false;
+
block_input ();
if (FONT_ENTITY_P (font))
{