From: Ben Harris Date: Sat, 26 Oct 2024 18:00:39 +0000 (+0100) Subject: Stop dopalt() reading off the end of the character bitmap X-Git-Tag: bedstead-3.246~100 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=b2bda72f7213448deb5ef22375d0b8da1cb549d1;p=bedstead.git Stop dopalt() reading off the end of the character bitmap Spotted by GCC -Warray-bounds. --- 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;