diff options
| author | YAMAMOTO Mitsuharu | 2019-07-06 14:08:47 +0900 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2019-07-06 14:08:47 +0900 |
| commit | 0e15bd11dc058d5efcdcb16436c3d8cf240859f6 (patch) | |
| tree | b75af2faf5b06fffc3705c7995cea4fb8101f0de | |
| parent | dde0320020429a2d2917895fc0e2f5a24ffe6348 (diff) | |
| download | emacs-0e15bd11dc058d5efcdcb16436c3d8cf240859f6.tar.gz emacs-0e15bd11dc058d5efcdcb16436c3d8cf240859f6.zip | |
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.
| -rw-r--r-- | src/macfont.m | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/macfont.m b/src/macfont.m index f736fbf0e1e..2b7f963fd61 100644 --- a/src/macfont.m +++ b/src/macfont.m | |||
| @@ -2076,7 +2076,7 @@ macfont_supports_charset_and_languages_p (CTFontDescriptorRef desc, | |||
| 2076 | ptrdiff_t j; | 2076 | ptrdiff_t j; |
| 2077 | 2077 | ||
| 2078 | for (j = 0; j < ASIZE (chars); j++) | 2078 | for (j = 0; j < ASIZE (chars); j++) |
| 2079 | if (TYPE_RANGED_FIXNUMP (UTF32Char, AREF (chars, j)) | 2079 | if (RANGED_FIXNUMP (0, AREF (chars, j), MAX_UNICODE_CHAR) |
| 2080 | && CFCharacterSetIsLongCharacterMember (desc_charset, | 2080 | && CFCharacterSetIsLongCharacterMember (desc_charset, |
| 2081 | XFIXNAT (AREF (chars, j)))) | 2081 | XFIXNAT (AREF (chars, j)))) |
| 2082 | break; | 2082 | break; |
| @@ -2710,6 +2710,9 @@ macfont_has_char (Lisp_Object font, int c) | |||
| 2710 | int result; | 2710 | int result; |
| 2711 | CFCharacterSetRef charset; | 2711 | CFCharacterSetRef charset; |
| 2712 | 2712 | ||
| 2713 | if (c < 0 || c > MAX_UNICODE_CHAR) | ||
| 2714 | return false; | ||
| 2715 | |||
| 2713 | block_input (); | 2716 | block_input (); |
| 2714 | if (FONT_ENTITY_P (font)) | 2717 | if (FONT_ENTITY_P (font)) |
| 2715 | { | 2718 | { |