patch 9.1.0069: ScreenLines may not be correctly initialized, causing hang
Problem: ScreenLines may not be correctly initialized, causing hang
(Olaf Seibert, after 9.0.0220)
Solution: always initialize ScreneLines when allocating a screen
(Olaf Seibert)
ScreenLines and related structures could be left uninitialized
causing a screen update to run into an infinite loop when using latin1
encoding.
Partly caused because by patch 9.0.0220, which makes mb_ptr2len return
zero for NUL
related: #12671
closes: #13946
Signed-off-by: Olaf Seibert <rhialto@falu.nl>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
59bafc8171
commit
fd472655a9
37
src/screen.c
37
src/screen.c
@ -2569,6 +2569,25 @@ give_up:
|
||||
new_LineOffset[new_row] = new_row * Columns;
|
||||
new_LineWraps[new_row] = FALSE;
|
||||
|
||||
(void)vim_memset(new_ScreenLines + new_row * Columns,
|
||||
' ', (size_t)Columns * sizeof(schar_T));
|
||||
if (enc_utf8)
|
||||
{
|
||||
(void)vim_memset(new_ScreenLinesUC + new_row * Columns,
|
||||
0, (size_t)Columns * sizeof(u8char_T));
|
||||
for (int i = 0; i < p_mco; ++i)
|
||||
(void)vim_memset(new_ScreenLinesC[i]
|
||||
+ new_row * Columns,
|
||||
0, (size_t)Columns * sizeof(u8char_T));
|
||||
}
|
||||
if (enc_dbcs == DBCS_JPNU)
|
||||
(void)vim_memset(new_ScreenLines2 + new_row * Columns,
|
||||
0, (size_t)Columns * sizeof(schar_T));
|
||||
(void)vim_memset(new_ScreenAttrs + new_row * Columns,
|
||||
0, (size_t)Columns * sizeof(sattr_T));
|
||||
(void)vim_memset(new_ScreenCols + new_row * Columns,
|
||||
0, (size_t)Columns * sizeof(colnr_T));
|
||||
|
||||
/*
|
||||
* If the screen is not going to be cleared, copy as much as
|
||||
* possible from the old screen to the new one and clear the rest
|
||||
@ -2577,24 +2596,6 @@ give_up:
|
||||
*/
|
||||
if (!doclear)
|
||||
{
|
||||
(void)vim_memset(new_ScreenLines + new_row * Columns,
|
||||
' ', (size_t)Columns * sizeof(schar_T));
|
||||
if (enc_utf8)
|
||||
{
|
||||
(void)vim_memset(new_ScreenLinesUC + new_row * Columns,
|
||||
0, (size_t)Columns * sizeof(u8char_T));
|
||||
for (int i = 0; i < p_mco; ++i)
|
||||
(void)vim_memset(new_ScreenLinesC[i]
|
||||
+ new_row * Columns,
|
||||
0, (size_t)Columns * sizeof(u8char_T));
|
||||
}
|
||||
if (enc_dbcs == DBCS_JPNU)
|
||||
(void)vim_memset(new_ScreenLines2 + new_row * Columns,
|
||||
0, (size_t)Columns * sizeof(schar_T));
|
||||
(void)vim_memset(new_ScreenAttrs + new_row * Columns,
|
||||
0, (size_t)Columns * sizeof(sattr_T));
|
||||
(void)vim_memset(new_ScreenCols + new_row * Columns,
|
||||
0, (size_t)Columns * sizeof(colnr_T));
|
||||
old_row = new_row + (screen_Rows - Rows);
|
||||
if (old_row >= 0 && ScreenLines != NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user