From: Po Lu Date: Tue, 22 Aug 2023 09:34:41 +0000 (+0800) Subject: Avoid crashes rescaling fonts with long names X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8e51a3e3f8fc6dcb7b195bf57722a72a281552e8;p=emacs.git Avoid crashes rescaling fonts with long names * src/font.c (font_rescale_ratio): Check NAME is not nil before matching it against a regexp. --- 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)))