diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-06-30 17:51:51 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-06-30 17:51:51 +0200 |
commit | e057d40d967a8223a34fe5b56ffb00dfd06e4cd4 (patch) | |
tree | 3c14b2bf97d6bb23721a33dfba7704b5fa91f6b5 /src | |
parent | 5a4d51e6929b1bb615eaf212a091384cc266b8d7 (diff) | |
download | vim-git-e057d40d967a8223a34fe5b56ffb00dfd06e4cd4.tar.gz |
updated for version 7.3.1278v7.3.1278
Problem: When someone sets the screen size to a huge value with "stty" Vim
runs out of memory before reducing the size.
Solution: Limit Rows and Columns in more places.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui.c | 1 | ||||
-rw-r--r-- | src/gui_gtk_x11.c | 1 | ||||
-rw-r--r-- | src/option.c | 6 | ||||
-rw-r--r-- | src/os_unix.c | 1 | ||||
-rw-r--r-- | src/proto/term.pro | 1 | ||||
-rw-r--r-- | src/term.c | 20 | ||||
-rw-r--r-- | src/version.c | 2 |
7 files changed, 24 insertions, 8 deletions
@@ -1620,6 +1620,7 @@ gui_set_shellsize(mustset, fit_to_display, direction) un_maximize = FALSE; #endif } + limit_screen_size(); gui.num_cols = Columns; gui.num_rows = Rows; diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 853947c1b..05295bf08 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -3698,6 +3698,7 @@ gui_mch_open(void) p_window = h - 1; Rows = h; } + limit_screen_size(); pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width); pixel_height = (guint)(gui_get_base_height() + Rows * gui.char_height); diff --git a/src/option.c b/src/option.c index d0e55a954..8911b015a 100644 --- a/src/option.c +++ b/src/option.c @@ -8528,11 +8528,7 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) } Columns = MIN_COLUMNS; } - /* Limit the values to avoid an overflow in Rows * Columns. */ - if (Columns > 10000) - Columns = 10000; - if (Rows > 1000) - Rows = 1000; + limit_screen_size(); #ifdef DJGPP /* avoid a crash by checking for a too large value of 'columns' */ diff --git a/src/os_unix.c b/src/os_unix.c index 8a7ae10b0..2223faf77 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3777,6 +3777,7 @@ mch_get_shellsize() Rows = rows; Columns = columns; + limit_screen_size(); return OK; } diff --git a/src/proto/term.pro b/src/proto/term.pro index 720d02854..25d9b96a0 100644 --- a/src/proto/term.pro +++ b/src/proto/term.pro @@ -26,6 +26,7 @@ void term_settitle __ARGS((char_u *title)); void ttest __ARGS((int pairs)); void add_long_to_buf __ARGS((long_u val, char_u *dst)); void check_shellsize __ARGS((void)); +void limit_screen_size __ARGS((void)); void win_new_shellsize __ARGS((void)); void shell_resized __ARGS((void)); void shell_resized_check __ARGS((void)); diff --git a/src/term.c b/src/term.c index 003dd8b1a..c2c5cf8db 100644 --- a/src/term.c +++ b/src/term.c @@ -2962,15 +2962,29 @@ get_bytes_from_buf(buf, bytes, num_bytes) #endif /* - * Check if the new shell size is valid, correct it if it's too small. + * Check if the new shell size is valid, correct it if it's too small or way + * too big. */ void check_shellsize() { - if (Columns < MIN_COLUMNS) - Columns = MIN_COLUMNS; if (Rows < min_rows()) /* need room for one window and command line */ Rows = min_rows(); + limit_screen_size(); +} + +/* + * Limit Rows and Columns to avoid an overflow in Rows * Columns. + */ + void +limit_screen_size() +{ + if (Columns < MIN_COLUMNS) + Columns = MIN_COLUMNS; + else if (Columns > 10000) + Columns = 10000; + if (Rows > 1000) + Rows = 1000; } /* diff --git a/src/version.c b/src/version.c index a3b0657ef..077c2a430 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1278, +/**/ 1277, /**/ 1276, |