Mercurial > vim
comparison src/screen.c @ 34257:8a91d18f1789 v9.1.0069
patch 9.1.0069: ScreenLines may not be correctly initialized, causing hang
Commit: https://github.com/vim/vim/commit/fd472655a93fd539c731c8daf3adc4e65ddce341
Author: Olaf Seibert <rhialto@falu.nl>
Date: Thu Feb 1 21:11:16 2024 +0100
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>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 01 Feb 2024 21:30:02 +0100 |
parents | e7d64a3fffe4 |
children | 321281d8b353 |
comparison
equal
deleted
inserted
replaced
34256:1ea7bd931de7 | 34257:8a91d18f1789 |
---|---|
2567 for (new_row = 0; new_row < Rows; ++new_row) | 2567 for (new_row = 0; new_row < Rows; ++new_row) |
2568 { | 2568 { |
2569 new_LineOffset[new_row] = new_row * Columns; | 2569 new_LineOffset[new_row] = new_row * Columns; |
2570 new_LineWraps[new_row] = FALSE; | 2570 new_LineWraps[new_row] = FALSE; |
2571 | 2571 |
2572 (void)vim_memset(new_ScreenLines + new_row * Columns, | |
2573 ' ', (size_t)Columns * sizeof(schar_T)); | |
2574 if (enc_utf8) | |
2575 { | |
2576 (void)vim_memset(new_ScreenLinesUC + new_row * Columns, | |
2577 0, (size_t)Columns * sizeof(u8char_T)); | |
2578 for (int i = 0; i < p_mco; ++i) | |
2579 (void)vim_memset(new_ScreenLinesC[i] | |
2580 + new_row * Columns, | |
2581 0, (size_t)Columns * sizeof(u8char_T)); | |
2582 } | |
2583 if (enc_dbcs == DBCS_JPNU) | |
2584 (void)vim_memset(new_ScreenLines2 + new_row * Columns, | |
2585 0, (size_t)Columns * sizeof(schar_T)); | |
2586 (void)vim_memset(new_ScreenAttrs + new_row * Columns, | |
2587 0, (size_t)Columns * sizeof(sattr_T)); | |
2588 (void)vim_memset(new_ScreenCols + new_row * Columns, | |
2589 0, (size_t)Columns * sizeof(colnr_T)); | |
2590 | |
2572 /* | 2591 /* |
2573 * If the screen is not going to be cleared, copy as much as | 2592 * If the screen is not going to be cleared, copy as much as |
2574 * possible from the old screen to the new one and clear the rest | 2593 * possible from the old screen to the new one and clear the rest |
2575 * (used when resizing the window at the "--more--" prompt or when | 2594 * (used when resizing the window at the "--more--" prompt or when |
2576 * executing an external command, for the GUI). | 2595 * executing an external command, for the GUI). |
2577 */ | 2596 */ |
2578 if (!doclear) | 2597 if (!doclear) |
2579 { | 2598 { |
2580 (void)vim_memset(new_ScreenLines + new_row * Columns, | |
2581 ' ', (size_t)Columns * sizeof(schar_T)); | |
2582 if (enc_utf8) | |
2583 { | |
2584 (void)vim_memset(new_ScreenLinesUC + new_row * Columns, | |
2585 0, (size_t)Columns * sizeof(u8char_T)); | |
2586 for (int i = 0; i < p_mco; ++i) | |
2587 (void)vim_memset(new_ScreenLinesC[i] | |
2588 + new_row * Columns, | |
2589 0, (size_t)Columns * sizeof(u8char_T)); | |
2590 } | |
2591 if (enc_dbcs == DBCS_JPNU) | |
2592 (void)vim_memset(new_ScreenLines2 + new_row * Columns, | |
2593 0, (size_t)Columns * sizeof(schar_T)); | |
2594 (void)vim_memset(new_ScreenAttrs + new_row * Columns, | |
2595 0, (size_t)Columns * sizeof(sattr_T)); | |
2596 (void)vim_memset(new_ScreenCols + new_row * Columns, | |
2597 0, (size_t)Columns * sizeof(colnr_T)); | |
2598 old_row = new_row + (screen_Rows - Rows); | 2599 old_row = new_row + (screen_Rows - Rows); |
2599 if (old_row >= 0 && ScreenLines != NULL) | 2600 if (old_row >= 0 && ScreenLines != NULL) |
2600 { | 2601 { |
2601 if (screen_Columns < Columns) | 2602 if (screen_Columns < Columns) |
2602 len = screen_Columns; | 2603 len = screen_Columns; |