shithub: cstory

Download patch

ref: 744ddcaacf3d3206be5c0169b04a9b3460ba34f4
parent: 59810343540806470388375f1bbb32f26cdd7967
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sun Oct 25 19:37:58 EDT 2020

Fix use of uninitialised memory in Font.cpp

This can cause random text corruption

--- a/src/Font.cpp
+++ b/src/Font.cpp
@@ -1191,6 +1191,8 @@
 
 							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->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];