diff options
author | Po Lu <luangruo@yahoo.com> | 2023-08-22 17:34:41 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2023-08-22 17:34:41 +0800 |
commit | 8e51a3e3f8fc6dcb7b195bf57722a72a281552e8 (patch) | |
tree | 06c8a8580bd2f2b92bab762b1030315bff4ec00d | |
parent | 269fd08dabf2d1fc07e52fa7f93b42daf1d3f6c8 (diff) | |
download | emacs-8e51a3e3f8fc6dcb7b195bf57722a72a281552e8.tar.gz |
Avoid crashes rescaling fonts with long names
* src/font.c (font_rescale_ratio): Check NAME is not nil before
matching it against a regexp.
-rw-r--r-- | src/font.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/font.c b/src/font.c index 7f8ddc4dc34..ff81fefcad0 100644 --- a/src/font.c +++ b/src/font.c @@ -1879,7 +1879,11 @@ font_rescale_ratio (Lisp_Object font_entity) { if (NILP (name)) name = Ffont_xlfd_name (font_entity, Qnil); - if (fast_string_match_ignore_case (XCAR (elt), name) >= 0) + + /* N.B. that `name' is set to nil if the resulting XLFD + is too long. */ + if (!NILP (name) + && fast_string_match_ignore_case (XCAR (elt), name) >= 0) return XFLOAT_DATA (XCDR (elt)); } else if (FONT_SPEC_P (XCAR (elt))) |