From: Pengpeng Dong Subject: [PATCH v2] conhost: Add the case where the divisor is 0. Message-Id: <114182b4-27de-fa07-2945-0c2838eb437d@uniontech.com> Date: Wed, 23 Sep 2020 09:33:19 +0800 From 9005ebd81c317606f0c31abf35d4e1b26f012246 Mon Sep 17 00:00:00 2001 From: Pengpeng Dong Date: Wed, 23 Sep 2020 09:24:44 +0800 Subject: [PATCH v2] conhost: Add the case where the divisor is 0. Signed-off-by: Pengpeng Dong --- programs/conhost/conhost.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index a775e74961..00baf87fed 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -2068,7 +2068,10 @@ static NTSTATUS write_output( struct screen_buffer *screen_buffer, const struct region->Left = x; region->Top = y; region->Right = min( x + width, screen_buffer->width ) - 1; - region->Bottom = min( y + entry_cnt / width, screen_buffer->height ) - 1; + if (width) + region->Bottom = min( y + entry_cnt / width, screen_buffer->height ) - 1; + else + return STATUS_INVALID_PARAMETER; } else { -- 2.20.1