aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-08-22 17:34:41 +0800
committerPo Lu2023-08-22 17:34:41 +0800
commit8e51a3e3f8fc6dcb7b195bf57722a72a281552e8 (patch)
tree06c8a8580bd2f2b92bab762b1030315bff4ec00d /src
parent269fd08dabf2d1fc07e52fa7f93b42daf1d3f6c8 (diff)
downloademacs-8e51a3e3f8fc6dcb7b195bf57722a72a281552e8.tar.gz
emacs-8e51a3e3f8fc6dcb7b195bf57722a72a281552e8.zip
Avoid crashes rescaling fonts with long names
* src/font.c (font_rescale_ratio): Check NAME is not nil before matching it against a regexp.
Diffstat (limited to 'src')
-rw-r--r--src/font.c6
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)
1879 { 1879 {
1880 if (NILP (name)) 1880 if (NILP (name))
1881 name = Ffont_xlfd_name (font_entity, Qnil); 1881 name = Ffont_xlfd_name (font_entity, Qnil);
1882 if (fast_string_match_ignore_case (XCAR (elt), name) >= 0) 1882
1883 /* N.B. that `name' is set to nil if the resulting XLFD
1884 is too long. */
1885 if (!NILP (name)
1886 && fast_string_match_ignore_case (XCAR (elt), name) >= 0)
1883 return XFLOAT_DATA (XCDR (elt)); 1887 return XFLOAT_DATA (XCDR (elt));
1884 } 1888 }
1885 else if (FONT_SPEC_P (XCAR (elt))) 1889 else if (FONT_SPEC_P (XCAR (elt)))