summaryrefslogtreecommitdiffstats
path: root/screen-write.c
diff options
context:
space:
mode:
authornicm <nicm>2021-01-27 10:42:52 +0000
committernicm <nicm>2021-01-27 10:42:52 +0000
commit8156d9ba416c28d76b445e5c74537c254a3bc110 (patch)
tree9f0f569fac1664fbe24190042e8c6d37a1c36bfe /screen-write.c
parentd6542c333d92aeee74c0a70939e5976de015bb0c (diff)
Flush pending output before entering or exiting alternate screen rather
than leaking it, oss-fuzz issue 29959.
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/screen-write.c b/screen-write.c
index f374630c..4811b0a1 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1970,6 +1970,8 @@ screen_write_alternateon(struct screen_write_ctx *ctx, struct grid_cell *gc,
if (wp != NULL && !options_get_number(wp->options, "alternate-screen"))
return;
+
+ screen_write_collect_flush(ctx, 0, __func__);
screen_alternate_on(ctx->s, gc, cursor);
screen_write_initctx(ctx, &ttyctx, 1);
@@ -1986,6 +1988,8 @@ screen_write_alternateoff(struct screen_write_ctx *ctx, struct grid_cell *gc,
if (wp != NULL && !options_get_number(wp->options, "alternate-screen"))
return;
+
+ screen_write_collect_flush(ctx, 0, __func__);
screen_alternate_off(ctx->s, gc, cursor);
screen_write_initctx(ctx, &ttyctx, 1);