From 8417e42d8bc6c15e62ccad63282075697597f449 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Mar 2025 15:30:28 +0530 Subject: [PATCH] Fix a regression in the previous release causing a crash when the underline thickness of the font is zero Fixes #8443 --- docs/changelog.rst | 3 +++ kitty/decorations.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index a9ab48f60..502ee0119 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -107,6 +107,9 @@ Detailed list of changes documents that point to executable files. Can be overridden by specifying your own :file:`launch-actions.conf`. +- Fix a regression in version 0.40.0 causing a crash when the underline + thickness of the font is zero (:iss:`8443`) + 0.40.1 [2025-03-18] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/decorations.c b/kitty/decorations.c index 0ec3bbfee..8ba1fa9f9 100644 --- a/kitty/decorations.c +++ b/kitty/decorations.c @@ -100,7 +100,7 @@ distribute_dots(unsigned available_space, unsigned num_of_dots, unsigned *summed DecorationGeometry add_dotted_underline(uint8_t *buf, FontCellMetrics fcm) { - unsigned num_of_dots = MAX(1u, fcm.cell_width / (2 * fcm.underline_thickness)); + unsigned num_of_dots = MAX(1u, fcm.cell_width / (2 * MAX(1u, fcm.underline_thickness))); RAII_ALLOC(unsigned, spacing, malloc(num_of_dots * 2 * sizeof(unsigned))); if (!spacing) fatal("Out of memory"); unsigned size = distribute_dots(fcm.cell_width, num_of_dots, spacing, spacing + num_of_dots);