Skip to content

Commit 294a7e5

Browse files
committed
patch 7.4.936
Problem: Crash when dragging with the mouse. Solution: Add safety check for NULL pointer. Check mouse position for valid value. (Hirohito Higashi)
1 parent 6040256 commit 294a7e5

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/term.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5231,6 +5231,13 @@ check_termcode(max_offset, buf, bufsize, buflen)
52315231
else
52325232
key_name[1] = get_pseudo_mouse_code(current_button,
52335233
is_click, is_drag);
5234+
5235+
/* Make sure the mouse position is valid. Some terminals may
5236+
* return weird values. */
5237+
if (mouse_col >= Columns)
5238+
mouse_col = Columns - 1;
5239+
if (mouse_row >= Rows)
5240+
mouse_row = Rows - 1;
52345241
}
52355242
#endif /* FEAT_MOUSE */
52365243

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
936,
744746
/**/
745747
935,
746748
/**/

src/window.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5785,6 +5785,8 @@ win_drag_vsep_line(dragwin, offset)
57855785
offset = room; /* Move as far as we can */
57865786
if (offset <= 0) /* No room at all, quit. */
57875787
return;
5788+
if (fr == NULL)
5789+
return; /* Safety check, should not happen. */
57885790

57895791
/* grow frame fr by offset lines */
57905792
frame_new_width(fr, fr->fr_width + offset, left, FALSE);

0 commit comments

Comments
 (0)