From 441555ea5656101e52c3da2db4a1783c68d356df Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Fri, 25 Nov 2022 22:51:42 +0100 Subject: [PATCH] LibVT: Prevent `u16` underflow when resizing terminal to a height of 1 Resizing the Terminal window to its smallest size no longer crashes. Fixes #7296. --- Userland/Libraries/LibVT/Terminal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibVT/Terminal.cpp b/Userland/Libraries/LibVT/Terminal.cpp index 865c532593..c6a1a5863c 100644 --- a/Userland/Libraries/LibVT/Terminal.cpp +++ b/Userland/Libraries/LibVT/Terminal.cpp @@ -781,7 +781,7 @@ void Terminal::scroll_up(u16 region_top, u16 region_bottom, size_t count) } // Set dirty flag on swapped lines. // The other lines have implicitly been set dirty by being cleared. - for (u16 row = region_top; row <= region_bottom - count; ++row) + for (u16 row = region_top; row + count <= region_bottom; ++row) active_buffer()[row].set_dirty(true); m_client.terminal_history_changed(history_delta); }