From b2bda72f7213448deb5ef22375d0b8da1cb549d1 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 26 Oct 2024 19:00:39 +0100 Subject: [PATCH] Stop dopalt() reading off the end of the character bitmap Spotted by GCC -Warray-bounds. --- bedstead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bedstead.c b/bedstead.c index db7caed..089cc0f 100644 --- a/bedstead.c +++ b/bedstead.c @@ -2618,7 +2618,7 @@ static struct glyph const *glyphs_by_name[NGLYPHS]; static void dolookups(struct glyph const *); static bool -getpix(char const data[YSIZE], int x, int y, unsigned flags) +getpix(char const data[YSIZE - 1], int x, int y, unsigned flags) { /* @@ -3093,7 +3093,7 @@ dopalt(struct glyph const *g) * one pixel, and a right side-bearing of zero. Space * characters get an advance width of three pixels. */ - for (i = 0; i < YSIZE; i++) + for (i = 0; i < YSIZE - 1; i++) cols |= g->data[i] & ((1 << XSIZE) - 1); if (cols == 0) dh = 3 - XSIZE; -- 2.30.2