[hackers] [PATCH] st: guard tsetdirt() against zero-sized terminal

From: Milos Nikic <nikic.milos_AT_gmail.com>
Date: Wed, 14 Jan 2026 21:00:32 -0800

tsetdirt() assumes term.row > 0. During early init or
resize paths this may not hold, leading to out-of-bounds
access. Bail out early if there are no rows.
---
 st.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/st.c b/st.c
index e55e7b3..6f40e35 100644
--- a/st.c
+++ b/st.c
_AT_@ -965,6 +965,9 @@ tsetdirt(int top, int bot)
 {
 	int i;
 
+	if (term.row <= 0)
+		return;
+
 	LIMIT(top, 0, term.row-1);
 	LIMIT(bot, 0, term.row-1);
 
-- 
2.52.0
Received on Thu Jan 15 2026 - 06:00:32 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 15 2026 - 06:12:33 CET