diff --git a/CHANGELOG.md b/CHANGELOG.md index 56045e29..3608f2f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `--help` output for `--class` does not match man pages - Cursor and underlines always being black on very old hardware +- Crash when using very low negative `font.offset` ## 0.11.0 diff --git a/alacritty/src/renderer/text/builtin_font.rs b/alacritty/src/renderer/text/builtin_font.rs index aeee6d91..c0355be6 100644 --- a/alacritty/src/renderer/text/builtin_font.rs +++ b/alacritty/src/renderer/text/builtin_font.rs @@ -37,8 +37,9 @@ pub fn builtin_glyph( } fn box_drawing(character: char, metrics: &Metrics, offset: &Delta) -> RasterizedGlyph { - let height = (metrics.line_height as i32 + offset.y as i32) as usize; - let width = (metrics.average_advance as i32 + offset.x as i32) as usize; + // Ensure that width and height is at least one. + let height = (metrics.line_height as i32 + offset.y as i32).max(1) as usize; + let width = (metrics.average_advance as i32 + offset.x as i32).max(1) as usize; // Use one eight of the cell width, since this is used as a step size for block elemenets. let stroke_size = cmp::max((width as f32 / 8.).round() as usize, 1); let heavy_stroke_size = stroke_size * 2;