summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-11-22 19:39:38 +0100
committerBram Moolenaar <Bram@vim.org>2015-11-22 19:39:38 +0100
commit294a7e55b01149154807a23323038784549b8946 (patch)
tree63d78d7e35a5c2100c97ae878a88949fb860af6d /src/term.c
parent6040256d8b0404564ac6f192296b12ea9d175e7d (diff)
downloadvim-git-294a7e55b01149154807a23323038784549b8946.tar.gz
patch 7.4.936v7.4.936
Problem: Crash when dragging with the mouse. Solution: Add safety check for NULL pointer. Check mouse position for valid value. (Hirohito Higashi)
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/term.c b/src/term.c
index 51698fb99..226bdee51 100644
--- a/src/term.c
+++ b/src/term.c
@@ -5231,6 +5231,13 @@ check_termcode(max_offset, buf, bufsize, buflen)
else
key_name[1] = get_pseudo_mouse_code(current_button,
is_click, is_drag);
+
+ /* Make sure the mouse position is valid. Some terminals may
+ * return weird values. */
+ if (mouse_col >= Columns)
+ mouse_col = Columns - 1;
+ if (mouse_row >= Rows)
+ mouse_row = Rows - 1;
}
#endif /* FEAT_MOUSE */