mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	Flush pending output before entering or exiting alternate screen rather
than leaking it, oss-fuzz issue 29959.
This commit is contained in:
		@@ -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"))
 | 
						if (wp != NULL && !options_get_number(wp->options, "alternate-screen"))
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						screen_write_collect_flush(ctx, 0, __func__);
 | 
				
			||||||
	screen_alternate_on(ctx->s, gc, cursor);
 | 
						screen_alternate_on(ctx->s, gc, cursor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	screen_write_initctx(ctx, &ttyctx, 1);
 | 
						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"))
 | 
						if (wp != NULL && !options_get_number(wp->options, "alternate-screen"))
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						screen_write_collect_flush(ctx, 0, __func__);
 | 
				
			||||||
	screen_alternate_off(ctx->s, gc, cursor);
 | 
						screen_alternate_off(ctx->s, gc, cursor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	screen_write_initctx(ctx, &ttyctx, 1);
 | 
						screen_write_initctx(ctx, &ttyctx, 1);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user