From 7e1a97795fab7c5bfb6bb851ad3c5ecda0fbd380 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 2 May 2026 07:52:07 +0530 Subject: [PATCH] Make CodeQL happy --- kitty/child-monitor.c | 4 ++-- kitty/screen.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index b6e5d7127..796202d50 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -889,11 +889,11 @@ thumbnail_callback(OSWindow *os_window) { double scale = 300. / vw; thumb_h = (unsigned)(vh * scale + 0.5f); } - RAII_PyObject(pixels, PyBytes_FromStringAndSize(NULL, 4 * thumb_w * thumb_h)); + RAII_PyObject(pixels, PyBytes_FromStringAndSize(NULL, (Py_ssize_t)4 * thumb_w * thumb_h)); if (pixels && global_state.boss) { take_screenshot_of_rectangular_region( os_window, region, (unsigned char*)PyBytes_AS_STRING(pixels), &thumb_w, &thumb_h); - _PyBytes_Resize(&pixels, 4 * thumb_w *thumb_h); + _PyBytes_Resize(&pixels, (Py_ssize_t)4 * thumb_w * thumb_h); PyObject *r = PyObject_CallMethod( global_state.boss, tc.callback, "KKOII", os_window->id, tc.window, pixels, thumb_w, thumb_h); if (!r) PyErr_Print(); else Py_DECREF(r); diff --git a/kitty/screen.c b/kitty/screen.c index 08f28908f..401f79410 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -3867,8 +3867,8 @@ void screen_apply_selection(Screen *self, void *address_, size_t size) { uint8_t *address = address_; memset(address, 0, size); - const int offset = pixel_scroll_enabled(self); - const unsigned int scrolled_by = self->paused_rendering.expires_at ? self->paused_rendering.scrolled_by : self->scrolled_by; + const unsigned offset = pixel_scroll_enabled(self); + const unsigned scrolled_by = self->paused_rendering.expires_at ? self->paused_rendering.scrolled_by : self->scrolled_by; Selections *sel = self->paused_rendering.expires_at ? &self->paused_rendering.selections : &self->selections; for (size_t i = 0; i < sel->count; i++) apply_selection(self, address, sel->items + i, 1, offset, scrolled_by); sel->last_rendered_count = sel->count; @@ -3879,7 +3879,7 @@ screen_apply_selection(Screen *self, void *address_, size_t size) { apply_selection(self, address, s, 2, offset, scrolled_by); } sel->last_rendered_count = sel->count; - address += offset * self->columns; size -= offset * self->columns; + address += (size_t)offset * self->columns; size -= (size_t)offset * self->columns; ExtraCursors *ec = self->paused_rendering.expires_at ? &self->paused_rendering.extra_cursors : &self->extra_cursors; for (unsigned i = 0; i < ec->count; i++) { if (ec->locations[i].cell < size) address[ec->locations[i].cell] |= (ec->locations[i].shape & 7) << 2;