]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.1278 v7.3.1278
authorBram Moolenaar <Bram@vim.org>
Sun, 30 Jun 2013 15:51:51 +0000 (17:51 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 30 Jun 2013 15:51:51 +0000 (17:51 +0200)
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.

src/gui.c
src/gui_gtk_x11.c
src/option.c
src/os_unix.c
src/proto/term.pro
src/term.c
src/version.c

index 06a99e6cba16e822d438ed8395ef095814095883..b667ba3e9dd1960e2243138d106a363e801250a6 100644 (file)
--- a/src/gui.c
+++ b/src/gui.c
@@ -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;
 
index 853947c1bbbbf742df9bc4428204fa52ac3ca8fe..05295bf08486b1ccb38b168cf8dce36e717b23d3 100644 (file)
@@ -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);
index d0e55a95494689022225c9c11627609f3a3b94af..8911b015ae070b332aeebc1f22371820c4faac52 100644 (file)
@@ -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' */
index 8a7ae10b0475175665e848dcf18f122b2cf1f43f..2223faf77d1c6c20073696435c361ce2a7c4a991 100644 (file)
@@ -3777,6 +3777,7 @@ mch_get_shellsize()
 
     Rows = rows;
     Columns = columns;
+    limit_screen_size();
     return OK;
 }
 
index 720d02854dd3e83f920306cbc2a10ca506b2d2f2..25d9b96a03097bde367377120d70294936612321 100644 (file)
@@ -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));
index 003dd8b1accd618c56b292d67d5d195d7c944c8b..c2c5cf8dbdccc96fca0d05d0968b9ec6fad59a6b 100644 (file)
@@ -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;
 }
 
 /*
index a3b0657ef6afea644531f229d3c78fcd78e3cb23..077c2a430b2fde91aa95b2804236fda526563c22 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1278,
 /**/
     1277,
 /**/