From: nicm Date: Wed, 27 Jan 2021 10:42:52 +0000 (+0000) Subject: Flush pending output before entering or exiting alternate screen rather X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=50fcbc36ffb9de38d3c52e7e41daef2194488f6f;p=openbsd Flush pending output before entering or exiting alternate screen rather than leaking it, oss-fuzz issue 29959. --- diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c index 917fbaeb3e5..d9a5bf8242a 100644 --- a/usr.bin/tmux/screen-write.c +++ b/usr.bin/tmux/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.191 2021/01/22 11:28:33 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.192 2021/01/27 10:42:52 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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);