LibGfx+Base: Tweak bitmap fonts to ensure glyph data is 4-byte aligned

When building userland with UBSAN enabled (#7434), we were getting
spammed to death by unaligned access errors.

Fix these by adding 2 bytes of padding to the FontFileHeader struct,
and adjusting all our font files to match the new format. :^)
This commit is contained in:
Andreas Kling 2021-05-24 08:18:34 +02:00
parent 22d8778437
commit 8f2425125e
Notes: sideshowbarker 2024-07-18 17:28:37 +09:00
24 changed files with 3 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -35,8 +35,11 @@ struct [[gnu::packed]] FontFileHeader {
u16 weight;
char name[32];
char family[32];
u16 unused;
};
static_assert(sizeof(FontFileHeader) == 80);
NonnullRefPtr<Font> BitmapFont::clone() const
{
size_t bytes_per_glyph = sizeof(u32) * glyph_height();