diff options
| author | Martin Rudalics | 2015-11-06 12:15:18 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2015-11-06 12:15:18 +0100 |
| commit | 40014fe9fd59b3332b3bec20c6973ef324192b7a (patch) | |
| tree | f59f0e5ca65b18095f1d6f87d026fd63f1fd64f4 /src | |
| parent | 29c360ee1cb0ba68470d831739d4df33016fada1 (diff) | |
| download | emacs-40014fe9fd59b3332b3bec20c6973ef324192b7a.tar.gz emacs-40014fe9fd59b3332b3bec20c6973ef324192b7a.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 6 | ||||
| -rw-r--r-- | src/xterm.c | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 91640769838..1a822f06365 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -1694,7 +1694,8 @@ required_matrix_height (struct window *w) | |||
| 1694 | 1694 | ||
| 1695 | if (FRAME_WINDOW_P (f)) | 1695 | if (FRAME_WINDOW_P (f)) |
| 1696 | { | 1696 | { |
| 1697 | int ch_height = FRAME_SMALLEST_FONT_HEIGHT (f); | 1697 | /* http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00194.html */ |
| 1698 | int ch_height = max (FRAME_SMALLEST_FONT_HEIGHT (f), 1); | ||
| 1698 | int window_pixel_height = window_box_height (w) + eabs (w->vscroll); | 1699 | int window_pixel_height = window_box_height (w) + eabs (w->vscroll); |
| 1699 | 1700 | ||
| 1700 | return (((window_pixel_height + ch_height - 1) | 1701 | return (((window_pixel_height + ch_height - 1) |
| @@ -1720,7 +1721,8 @@ required_matrix_width (struct window *w) | |||
| 1720 | struct frame *f = XFRAME (w->frame); | 1721 | struct frame *f = XFRAME (w->frame); |
| 1721 | if (FRAME_WINDOW_P (f)) | 1722 | if (FRAME_WINDOW_P (f)) |
| 1722 | { | 1723 | { |
| 1723 | int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f); | 1724 | /* http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00194.html */ |
| 1725 | int ch_width = max (FRAME_SMALLEST_CHAR_WIDTH (f), 1); | ||
| 1724 | 1726 | ||
| 1725 | /* Compute number of glyphs needed in a glyph row. */ | 1727 | /* Compute number of glyphs needed in a glyph row. */ |
| 1726 | return (((WINDOW_PIXEL_WIDTH (w) + ch_width - 1) | 1728 | return (((WINDOW_PIXEL_WIDTH (w) + ch_width - 1) |
diff --git a/src/xterm.c b/src/xterm.c index 691ad05efe1..5e9c16b8af4 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) | |||
| 11963 | dpyinfo->display = dpy; | 11963 | dpyinfo->display = dpy; |
| 11964 | dpyinfo->connection = ConnectionNumber (dpyinfo->display); | 11964 | dpyinfo->connection = ConnectionNumber (dpyinfo->display); |
| 11965 | 11965 | ||
| 11966 | /* http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00194.html */ | ||
| 11967 | dpyinfo->smallest_font_height = 1; | ||
| 11968 | dpyinfo->smallest_char_width = 1; | ||
| 11969 | |||
| 11966 | /* Set the name of the terminal. */ | 11970 | /* Set the name of the terminal. */ |
| 11967 | terminal->name = xlispstrdup (display_name); | 11971 | terminal->name = xlispstrdup (display_name); |
| 11968 | 11972 | ||