# HG changeset patch # User Bram Moolenaar # Date 1562940904 -7200 # Node ID 61f0bf94ef925af83ebd85967de7d76b47b41390 # Parent c3dcc589da007c184b00051aba6fb43345ce9866 patch 8.1.1665: crash when popup window with mask is below the screen commit https://github.com/vim/vim/commit/b4207474780569bcc9840e03f13edb5d9c2554f5 Author: Bram Moolenaar Date: Fri Jul 12 16:05:45 2019 +0200 patch 8.1.1665: crash when popup window with mask is below the screen Problem: Crash when popup window with mask is below the screen. Solution: Correct boundary check. diff --git a/src/popupwin.c b/src/popupwin.c --- a/src/popupwin.c +++ b/src/popupwin.c @@ -2323,8 +2323,10 @@ update_popup_transparent(win_T *wp, int --lines; if (lines < 0) lines = 0; - for (line = lines; line < linee && line < screen_Rows; ++line) - for (col = cols; col < cole && col < screen_Columns; ++col) + for (line = lines; line < linee + && line + wp->w_winrow < screen_Rows; ++line) + for (col = cols; col < cole + && col + wp->w_wincol < screen_Columns; ++col) popup_transparent[(line + wp->w_winrow) * screen_Columns + col + wp->w_wincol] = val; } diff --git a/src/testdir/dumps/Test_popupwin_mask_5.dump b/src/testdir/dumps/Test_popupwin_mask_5.dump new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_popupwin_mask_5.dump @@ -0,0 +1,13 @@ +>1+0&#ffffff0|2|3|4|5|6|7|8|9|1|0|1@2|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 +|1|2|3|4|5|6|7|8|9|1|0|1@2|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 +|1|2|3|4|5|6|7|8|9|1|0|1@2|2|1|3|x+0#0000001#ffd7ff255@8|8+0#0000000#ffffff0|1|9|2|0|2|1|2@2|3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|2|1|2@2|3|2|4|2|5|2|6|2|7|2|8|2|9|3|0|3|1|3|2|3@2|4|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 +| +0&#e0e0e08@11|1+0&#ffffff0@1|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|2|6|═+0#0000001#ffd7ff255@13|X|4+0#0000000#ffffff0|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 +|o+0&#e0e0e08|m|e| |5+0&#ffffff0|6|7|t+0&#e0e0e08| @3|1+0&#ffffff0@1|2|1|3|1|4|1|5|1|6|1|7|1|8|1|9|2|0|2|1|2@2|3|2|4|2|5|║+0#0000001#ffd7ff255| @4|2+0#0000000#ffffff0|9|3| +0#0000001#ffd7ff255@6|║|4+0#0000000#ffffff0|3|5|3|6|3|7|3|8|3|9|4|0|4|1|4|2 +|:|c|t+0&#e0e0e08|h|l+0&#ffffff0| |p|l+0&#e0e0e08|i|n|e| |m+0&#ffffff0|o|v|e|(|w|i|n|i|d|b|,| |{|'|p|o|s|'|:| |'|t|o|p|l|e|f|t|║+0#0000001#ffd7ff255| |j|u|s|t|l+0#0000000#ffffff0|'|:|e+0#0000001#ffd7ff255| |l|i|n|e| |║|,+0#0000000#ffffff0|1| @10|T|o|p| diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim --- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -486,6 +486,10 @@ func Test_popup_with_mask() call term_sendkeys(buf, ":call popup_move(winidb, {'pos': 'topright', 'col': 12})\") call VerifyScreenDump(buf, 'Test_popupwin_mask_4', {}) + call term_sendkeys(buf, ":call popup_move(winid, {'pos': 'topright', 'col': 12, 'line': 11})\") + call term_sendkeys(buf, ":call popup_move(winidb, {'pos': 'topleft', 'col': 42, 'line': 11})\") + call VerifyScreenDump(buf, 'Test_popupwin_mask_5', {}) + " clean up call StopVimInTerminal(buf) call delete('XtestPopupMask') diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -778,6 +778,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1665, +/**/ 1664, /**/ 1663,