summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-12 16:05:45 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-12 16:05:45 +0200
commitb4207474780569bcc9840e03f13edb5d9c2554f5 (patch)
tree0dc0e386c11d123e867c0824bff7a50b37b26da1
parent847a5d69a826c02a7cb8a14884f3fef69d74fed7 (diff)
downloadvim-git-b4207474780569bcc9840e03f13edb5d9c2554f5.tar.gz
patch 8.1.1665: crash when popup window with mask is below the screenv8.1.1665
Problem: Crash when popup window with mask is below the screen. Solution: Correct boundary check.
-rw-r--r--src/popupwin.c6
-rw-r--r--src/testdir/dumps/Test_popupwin_mask_5.dump13
-rw-r--r--src/testdir/test_popupwin.vim4
-rw-r--r--src/version.c2
4 files changed, 23 insertions, 2 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index 484f77406..968f6eeda 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -2323,8 +2323,10 @@ update_popup_transparent(win_T *wp, int val)
--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
index 000000000..4da3ded06
--- /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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|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|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
+| +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
index 4e3170ce3..104ebd57d 100644
--- 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})\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_mask_4', {})
+ call term_sendkeys(buf, ":call popup_move(winid, {'pos': 'topright', 'col': 12, 'line': 11})\<CR>")
+ call term_sendkeys(buf, ":call popup_move(winidb, {'pos': 'topleft', 'col': 42, 'line': 11})\<CR>")
+ 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
index 68b5465ad..9d012bd2d 100644
--- 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,