[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master e2879c1: Avoid infloops in font_open_entity
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master e2879c1: Avoid infloops in font_open_entity |
Date: |
Sat, 5 May 2018 04:53:13 -0400 (EDT) |
branch: master
commit e2879c1f837059335af89022b2a9ac9bc861e96d
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Avoid infloops in font_open_entity
* src/font.c (font_open_entity): Fail after 15 iterations through
the loop that looks for a font whose average_width and height are
both positive. This avoids infinite loops for fonts that, e.g.,
report average_width of zero for any possible size we try.
(Bug#31316)
---
src/font.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/font.c b/src/font.c
index ef3f92b..305bb14 100644
--- a/src/font.c
+++ b/src/font.c
@@ -2906,6 +2906,9 @@ font_open_entity (struct frame *f, Lisp_Object entity,
int pixel_size)
font = XFONT_OBJECT (font_object);
if (font->average_width > 0 && font->height > 0)
break;
+ /* Avoid an infinite loop. */
+ if (psize > pixel_size + 15)
+ return Qnil;
}
ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size));
FONT_ADD_LOG ("open", entity, font_object);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master e2879c1: Avoid infloops in font_open_entity,
Eli Zaretskii <=