summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/grid.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2019-04-01 19:33:39 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2019-04-01 19:33:39 +0000
commit6e4a96d6df3ca3b8cb704bb69153581575c2454b (patch)
tree0f18ddeca0d4483501eca227a49075765b55d781 /usr.bin/tmux/grid.c
parent4303225d8607553a5fac899388a3f3393d0bba7b (diff)
Restore a check to stop scrolled lines becoming larger than total lines,
fixes a crash reported by Thomas Sattler.
Diffstat (limited to 'usr.bin/tmux/grid.c')
-rw-r--r--usr.bin/tmux/grid.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c
index fbbc0712109..e4edba4367b 100644
--- a/usr.bin/tmux/grid.c
+++ b/usr.bin/tmux/grid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grid.c,v 1.91 2019/03/20 19:19:11 nicm Exp $ */
+/* $OpenBSD: grid.c,v 1.92 2019/04/01 19:33:38 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1284,6 +1284,8 @@ grid_reflow(struct grid *gd, u_int sx)
if (target->sy < gd->sy)
grid_reflow_add(target, gd->sy - target->sy);
gd->hsize = target->sy - gd->sy;
+ if (gd->hscrolled > gd->hsize)
+ gd->hscrolled = gd->hsize;
free(gd->linedata);
gd->linedata = target->linedata;
free(target);