From 6d034d04a0eedc6126f0c8cfa447ccf08ddd1949 Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Tue, 24 Dec 2024 22:47:38 -0500 Subject: [PATCH] fix: memory corruption in `Screen.cursorScrollAboveRotate` Unless it's guaranteed that the new pin is in the same page as the old one, `cursor.page_pin` should only be updated through `cursorChangePin`, not directly. --- src/terminal/Screen.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 52fba95ef..57818b351 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -863,7 +863,7 @@ pub fn cursorScrollAbove(self: *Screen) !void { } fn cursorScrollAboveRotate(self: *Screen) !void { - self.cursor.page_pin.* = self.cursor.page_pin.down(1).?; + self.cursorChangePin(self.cursor.page_pin.down(1).?); // Go through each of the pages following our pin, shift all rows // down by one, and copy the last row of the previous page.