]> granicus.if.org Git - vim/commitdiff
patch 8.1.1916: trying to allocate negative amount of memory closing popup v8.1.1916
authorBram Moolenaar <Bram@vim.org>
Sat, 24 Aug 2019 12:16:32 +0000 (14:16 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 24 Aug 2019 12:16:32 +0000 (14:16 +0200)
Problem:    Trying to allocate negative amount of memory when closing a popup.
Solution:   Check the rows are not out of bounds.  Don't finish a selection if
            it was never started.

src/ui.c
src/version.c

index 61f19bc4bc855d37393770058a894cbd0833df1c..7095eda02e8f77192614d3b4c77268ad5e920002 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
@@ -1184,7 +1184,10 @@ clip_process_selection(
 
     if (button == MOUSE_RELEASE)
     {
-       /* Check to make sure we have something selected */
+       if (cb->state != SELECT_IN_PROGRESS)
+           return;
+
+       // Check to make sure we have something selected
        if (cb->start.lnum == cb->end.lnum && cb->start.col == cb->end.col)
        {
 #ifdef FEAT_GUI
@@ -1591,6 +1594,8 @@ clip_copy_modeless_selection(int both UNUSED)
        col1 = clip_star.min_col;
     if (col2 > clip_star.max_col)
        col2 = clip_star.max_col;
+    if (row1 > clip_star.max_row || row2 < clip_star.min_row)
+       return;
     if (row1 < clip_star.min_row)
        row1 = clip_star.min_row;
     if (row2 > clip_star.max_row)
index 8ece6f1cbe244ba804a150b6a3b29aa98b49ca42..51851e33b8612ac7e33932f2f2759c007ec76409 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1916,
 /**/
     1915,
 /**/