From 744ddcaacf3d3206be5c0169b04a9b3460ba34f4 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Sun, 25 Oct 2020 23:37:58 +0000 Subject: [PATCH] Fix use of uninitialised memory in Font.cpp This can cause random text corruption --- src/Font.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Font.cpp b/src/Font.cpp index 65269b2b..76f2fc45 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -1191,6 +1191,8 @@ Font* LoadFreeTypeFontFromData(const unsigned char *data, size_t data_size, size font->glyphs[i].x = (i % font->atlas_row_length) * atlas_entry_width; font->glyphs[i].y = (i / font->atlas_row_length) * atlas_entry_height; + + font->glyphs[i].unicode_value = 0; } font->glyph_list_head = &font->glyphs[TOTAL_GLYPH_SLOTS - 1]; @@ -1290,6 +1292,8 @@ Font* LoadBitmapFont(const char *bitmap_path, const char *metadata_path) font->glyphs[i].x = (i % font->atlas_row_length) * atlas_entry_width; font->glyphs[i].y = (i / font->atlas_row_length) * atlas_entry_height; + + font->glyphs[i].unicode_value = 0; } font->glyph_list_head = &font->glyphs[TOTAL_GLYPH_SLOTS - 1];