1
0
forked from aniani/vim

updated for version 7.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.
This commit is contained in:
Bram Moolenaar
2013-06-30 17:51:51 +02:00
parent 5a4d51e692
commit e057d40d96
7 changed files with 24 additions and 8 deletions

View 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;
}
/*