vim-patch:7.4.936 #4271

Problem:    Crash when dragging with the mouse.
Solution:   Add safety check for NULL pointer. Check mouse position for valid
            value. (Hirohito Higashi)

294a7e55b0

---

see: "Crash while mouse-selecting in two-buffer mode"
     https://github.com/vim/vim/issues/486

Fix #3704
This commit is contained in:
watiko
2016-02-16 23:05:47 +09:00
committed by Justin M. Keyes
parent bfe9ebcbe1
commit 9403ce82bc
3 changed files with 21 additions and 4 deletions

View File

@@ -4575,10 +4575,19 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
}
assert(fr);
if (room < offset) /* Not enough room */
offset = room; /* Move as far as we can */
if (offset <= 0) /* No room at all, quit. */
// Not enough room
if (room < offset) {
offset = room; // Move as far as we can
}
// No room at all, quit.
if (offset <= 0) {
return;
}
if (fr == NULL) {
return; // Safety check, should not happen.
}
/* grow frame fr by offset lines */
frame_new_width(fr, fr->fr_width + offset, left, FALSE);