From 8fdd69b79521f7e0faa1eef67bb35180b35575bd Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Tue, 24 Dec 2024 22:47:38 -0500 Subject: [PATCH] fix: potential 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 7170fc648..47359a919 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -878,7 +878,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.