termptyesc: restrict right/bottom rectangle coordinates

This commit is contained in:
Boris Faure 2017-06-07 20:40:17 +02:00
parent 2076c0de76
commit 956f1eaa13
1 changed files with 4 additions and 0 deletions

View File

@ -857,6 +857,8 @@ _clean_up_rect_coordinates(Termpty *ty,
if (ty->termstate.right_margin && right >= ty->termstate.right_margin)
right = ty->termstate.right_margin;
}
if (right > ty->w)
right = ty->w;
if (bottom < 1)
bottom = ty->h;
@ -867,6 +869,8 @@ _clean_up_rect_coordinates(Termpty *ty,
bottom = ty->termstate.bottom_margin - 1;
}
bottom--;
if (bottom > ty->h)
bottom = ty->h;
if ((bottom < top) || (right < left))
return -1;