]> granicus.if.org Git - vim/commitdiff
patch 8.1.1665: crash when popup window with mask is below the screen v8.1.1665
authorBram Moolenaar <Bram@vim.org>
Fri, 12 Jul 2019 14:05:45 +0000 (16:05 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 12 Jul 2019 14:05:45 +0000 (16:05 +0200)
Problem:    Crash when popup window with mask is below the screen.
Solution:   Correct boundary check.

src/popupwin.c
src/testdir/dumps/Test_popupwin_mask_5.dump [new file with mode: 0644]
src/testdir/test_popupwin.vim
src/version.c

index 484f77406743bcb8b7d535a0bedbea3a2560ad74..968f6eeda42714700f7b958b5efbecb7b0169afc 100644 (file)
@@ -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 (file)
index 0000000..4da3ded
--- /dev/null
@@ -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|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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| 
index 4e3170ce3a722a7b9f07806ebc00655e8fb75de5..104ebd57d90ff8169729bd53c21ee209a509cacf 100644 (file)
@@ -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')
index 68b5465adbd82a6e70713c406eb6c798ad87b452..9d012bd2d34137b305c8bc0733fa111e544380ae 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1665,
 /**/
     1664,
 /**/