patch 8.2.4106: going over the end of the w_lines array
Problem: Going over the end of the w_lines array.
Solution: Break out of the loop when "idx" is too big. (issue #9540)
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 453ca91..e0fb122 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -2539,6 +2539,11 @@
eof = TRUE;
break;
}
+
+ // Safety check: if any of the wl_size values is wrong we might go over
+ // the end of w_lines[].
+ if (idx >= Rows)
+ break;
}
// End of loop over all window lines.