mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
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:
parent
5a4d51e692
commit
e057d40d96
@ -1620,6 +1620,7 @@ gui_set_shellsize(mustset, fit_to_display, direction)
|
|||||||
un_maximize = FALSE;
|
un_maximize = FALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
limit_screen_size();
|
||||||
gui.num_cols = Columns;
|
gui.num_cols = Columns;
|
||||||
gui.num_rows = Rows;
|
gui.num_rows = Rows;
|
||||||
|
|
||||||
|
@ -3698,6 +3698,7 @@ gui_mch_open(void)
|
|||||||
p_window = h - 1;
|
p_window = h - 1;
|
||||||
Rows = h;
|
Rows = h;
|
||||||
}
|
}
|
||||||
|
limit_screen_size();
|
||||||
|
|
||||||
pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width);
|
pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width);
|
||||||
pixel_height = (guint)(gui_get_base_height() + Rows * gui.char_height);
|
pixel_height = (guint)(gui_get_base_height() + Rows * gui.char_height);
|
||||||
|
@ -8528,11 +8528,7 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
|
|||||||
}
|
}
|
||||||
Columns = MIN_COLUMNS;
|
Columns = MIN_COLUMNS;
|
||||||
}
|
}
|
||||||
/* Limit the values to avoid an overflow in Rows * Columns. */
|
limit_screen_size();
|
||||||
if (Columns > 10000)
|
|
||||||
Columns = 10000;
|
|
||||||
if (Rows > 1000)
|
|
||||||
Rows = 1000;
|
|
||||||
|
|
||||||
#ifdef DJGPP
|
#ifdef DJGPP
|
||||||
/* avoid a crash by checking for a too large value of 'columns' */
|
/* avoid a crash by checking for a too large value of 'columns' */
|
||||||
|
@ -3777,6 +3777,7 @@ mch_get_shellsize()
|
|||||||
|
|
||||||
Rows = rows;
|
Rows = rows;
|
||||||
Columns = columns;
|
Columns = columns;
|
||||||
|
limit_screen_size();
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ void term_settitle __ARGS((char_u *title));
|
|||||||
void ttest __ARGS((int pairs));
|
void ttest __ARGS((int pairs));
|
||||||
void add_long_to_buf __ARGS((long_u val, char_u *dst));
|
void add_long_to_buf __ARGS((long_u val, char_u *dst));
|
||||||
void check_shellsize __ARGS((void));
|
void check_shellsize __ARGS((void));
|
||||||
|
void limit_screen_size __ARGS((void));
|
||||||
void win_new_shellsize __ARGS((void));
|
void win_new_shellsize __ARGS((void));
|
||||||
void shell_resized __ARGS((void));
|
void shell_resized __ARGS((void));
|
||||||
void shell_resized_check __ARGS((void));
|
void shell_resized_check __ARGS((void));
|
||||||
|
20
src/term.c
20
src/term.c
@ -2962,15 +2962,29 @@ get_bytes_from_buf(buf, bytes, num_bytes)
|
|||||||
#endif
|
#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
|
void
|
||||||
check_shellsize()
|
check_shellsize()
|
||||||
{
|
{
|
||||||
if (Columns < MIN_COLUMNS)
|
|
||||||
Columns = MIN_COLUMNS;
|
|
||||||
if (Rows < min_rows()) /* need room for one window and command line */
|
if (Rows < min_rows()) /* need room for one window and command line */
|
||||||
Rows = min_rows();
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -728,6 +728,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1278,
|
||||||
/**/
|
/**/
|
||||||
1277,
|
1277,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user