emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8e51a3e3f8f: Avoid crashes rescaling fonts with long names


From: Po Lu
Subject: master 8e51a3e3f8f: Avoid crashes rescaling fonts with long names
Date: Tue, 22 Aug 2023 05:34:56 -0400 (EDT)

branch: master
commit 8e51a3e3f8fc6dcb7b195bf57722a72a281552e8
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Avoid crashes rescaling fonts with long names
    
    * src/font.c (font_rescale_ratio): Check NAME is not nil before
    matching it against a regexp.
---
 src/font.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]