Fix a slew of possible int vs u_int bugs which would likely have caused an overflow crash.

This commit is contained in:
Michael Grant
2026-03-18 13:04:21 +00:00
parent 0d195698f8
commit 7e6bbc63ab
10 changed files with 155 additions and 133 deletions

6
tty.c
View File

@@ -1319,9 +1319,11 @@ tty_clear_area(struct tty *tty, const struct tty_ctx *ctx, u_int py,
TAILQ_FOREACH(wpl, &w->z_index, zentry) {
if (wpl == wp || ~wpl->flags & PANE_FLOATING)
continue;
if ((int)wpl->xoff - 1 > (int)(px + nx) || wpl->xoff + wpl->sx + 1 < px)
if ((int)wpl->xoff - 1 > (int)(px + nx) ||
wpl->xoff + (int)wpl->sx + 1 < (int)px)
continue;
if ((int)wpl->yoff - 1 > (int)(py + ny) || wpl->yoff + wpl->sy + 1 < py)
if ((int)wpl->yoff - 1 > (int)(py + ny) ||
wpl->yoff + (int)wpl->sy + 1 < (int)py)
continue;
overlap++;
if (overlap > 0) break;