Stop dopalt() reading off the end of the character bitmap

Spotted by GCC -Warray-bounds.
This commit is contained in:
Ben Harris 2024-10-26 19:00:39 +01:00
parent e129bcd034
commit b2bda72f72

View File

@ -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;