From 54b802f1e628529124d2b48fa1f3c8b663bd6f0c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Dec 2017 13:45:11 +0530 Subject: [PATCH] Ensure bounds in add_dline() --- kitty/fonts/render.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kitty/fonts/render.py b/kitty/fonts/render.py index 02175387d..774ec6d2f 100644 --- a/kitty/fonts/render.py +++ b/kitty/fonts/render.py @@ -93,6 +93,8 @@ def add_dline(buf, cell_width, position, thickness, cell_height): top -= deficit - 1 else: top -= deficit + top = max(0, min(top, cell_height - 1)) + bottom = max(0, min(bottom, cell_height - 1)) for y in {top, bottom}: ctypes.memset(ctypes.addressof(buf) + (cell_width * y), 255, cell_width)