Subject: bug#35814: 27.0.50; Broken font display

From: Alex Gramiak <[email-masked]>
Date: Tue, 21 May 2019 15:19:29 -0600

Andy Moreton <[email-masked]> writes:

> Alex, at the end of xfont_draw() in xfont.c, we now have:
>
>       else
>         {
>           const unsigned code = s->char2b[from];
>           const XChar2b char2b = { .byte1 = code >> 8,
>                                    .byte2 = code & 0xFF };
>           XDrawImageString16 (display, FRAME_X_DRAWABLE (s->f),
>                               gc, x, y, &char2b, len);
>         }
>
> and:
>       else
>         {
>           const unsigned code = s->char2b[from];
>           const XChar2b char2b = { .byte1 = code >> 8,
>                                    .byte2 = code & 0xFF };
>           XDrawString16 (display, FRAME_X_DRAWABLE (s->f),
>                          gc, x, y, &char2b, len);
>         }
>
> Both of these pass "len", but use a single XChar2b on the stack, so
> this causes an overrun (and draws random stack contents).

Wow, sorry, that was a bad mistake. I've applied commit 5a024b72c to
master; can those who experience the bug affirm that it's been fixed?

It appears that I only tested with fonts that make s->padding_p true,
and I can't seem to find a font on my system that doesn't.