1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:57:45 +00:00

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
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; u16 weight;
char name[32]; char name[32];
char family[32]; char family[32];
u16 unused;
}; };
static_assert(sizeof(FontFileHeader) == 80);
NonnullRefPtr<Font> BitmapFont::clone() const NonnullRefPtr<Font> BitmapFont::clone() const
{ {
size_t bytes_per_glyph = sizeof(u32) * glyph_height(); size_t bytes_per_glyph = sizeof(u32) * glyph_height();