From 0f2bcfabb37a380c0e19927f54b51eb99fe14d66 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 29 Nov 2017 08:30:34 +0530 Subject: [PATCH] Sanity check when moving baseline for line height adjustment --- kitty/fonts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kitty/fonts.c b/kitty/fonts.c index d56e6f21f..6e2fb06f0 100644 --- a/kitty/fonts.c +++ b/kitty/fonts.c @@ -291,8 +291,8 @@ update_cell_metrics() { if (cell_height > 1000) { PyErr_SetString(PyExc_ValueError, "line height too large after adjustment"); return NULL; } underline_position = MIN(cell_height - 1, underline_position); if (line_height_adjustment > 1) { - baseline += line_height_adjustment / 2; - underline_position += line_height_adjustment / 2; + baseline += MIN(cell_height - 1, (unsigned)line_height_adjustment / 2); + underline_position += MIN(cell_height - 1, (unsigned)line_height_adjustment / 2); } sprite_tracker_set_layout(cell_width, cell_height); global_state.cell_width = cell_width; global_state.cell_height = cell_height;