[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 40014fe: Avoid division by zero crash observed by Y
From: |
Martin Rudalics |
Subject: |
[Emacs-diffs] master 40014fe: Avoid division by zero crash observed by Yuan MEI. |
Date: |
Fri, 06 Nov 2015 11:16:28 +0000 |
branch: master
commit 40014fe9fd59b3332b3bec20c6973ef324192b7a
Author: Martin Rudalics <address@hidden>
Commit: Martin Rudalics <address@hidden>
Avoid division by zero crash observed by Yuan MEI.
See http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00194.html.
* src/dispnew.c (required_matrix_height, required_matrix_width):
Avoid division by zero.
* src/xterm.c (x_term_init): Init dpyinfo->smallest_font_height and
dpyinfo->smallest_char_width to 1.
---
src/dispnew.c | 6 ++++--
src/xterm.c | 4 ++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/dispnew.c b/src/dispnew.c
index 9164076..1a822f0 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1694,7 +1694,8 @@ required_matrix_height (struct window *w)
if (FRAME_WINDOW_P (f))
{
- int ch_height = FRAME_SMALLEST_FONT_HEIGHT (f);
+ /* http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00194.html
*/
+ int ch_height = max (FRAME_SMALLEST_FONT_HEIGHT (f), 1);
int window_pixel_height = window_box_height (w) + eabs (w->vscroll);
return (((window_pixel_height + ch_height - 1)
@@ -1720,7 +1721,8 @@ required_matrix_width (struct window *w)
struct frame *f = XFRAME (w->frame);
if (FRAME_WINDOW_P (f))
{
- int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f);
+ /* http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00194.html
*/
+ int ch_width = max (FRAME_SMALLEST_CHAR_WIDTH (f), 1);
/* Compute number of glyphs needed in a glyph row. */
return (((WINDOW_PIXEL_WIDTH (w) + ch_width - 1)
diff --git a/src/xterm.c b/src/xterm.c
index 691ad05..5e9c16b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -11963,6 +11963,10 @@ x_term_init (Lisp_Object display_name, char
*xrm_option, char *resource_name)
dpyinfo->display = dpy;
dpyinfo->connection = ConnectionNumber (dpyinfo->display);
+ /* http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00194.html */
+ dpyinfo->smallest_font_height = 1;
+ dpyinfo->smallest_char_width = 1;
+
/* Set the name of the terminal. */
terminal->name = xlispstrdup (display_name);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 40014fe: Avoid division by zero crash observed by Yuan MEI.,
Martin Rudalics <=