diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-24 14:16:32 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-24 14:16:32 +0200 |
commit | 741ea17038d4b227a4433c87d918a9da0737fc50 (patch) | |
tree | 575fc89d42638736525fee0ecb20403825009114 /src/ui.c | |
parent | 1a3a89168d61c2fed91cbca812cf1c6983901b79 (diff) | |
download | vim-git-741ea17038d4b227a4433c87d918a9da0737fc50.tar.gz |
patch 8.1.1916: trying to allocate negative amount of memory closing popupv8.1.1916
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.
Diffstat (limited to 'src/ui.c')
-rw-r--r-- | src/ui.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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) |