From 40510539eea9676f87988577e8910fcaee9abbf7 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Tue, 25 Oct 2022 15:57:31 +0300 Subject: [PATCH] Fix interface font loading --- src/font_manager.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/font_manager.cc b/src/font_manager.cc index a9c5a1a..85d8f2d 100644 --- a/src/font_manager.cc +++ b/src/font_manager.cc @@ -159,12 +159,12 @@ static int interfaceFontLoad(int font_index) interfaceFontByteSwapInt32(&(glyph->offset)); } - fileSize -= sizeof(InterfaceFontDescriptor); + int glyphDataSize = fileSize - 2060; - fontDescriptor->data = (unsigned char*)internal_malloc_safe(fileSize, __FILE__, __LINE__); // FONTMGR.C, 259 + fontDescriptor->data = (unsigned char*)internal_malloc_safe(glyphDataSize, __FILE__, __LINE__); // FONTMGR.C, 259 if (fontDescriptor->data == NULL) goto err; - if (fileRead(fontDescriptor->data, fileSize, 1, stream) != 1) { + if (fileRead(fontDescriptor->data, glyphDataSize, 1, stream) != 1) { internal_free_safe(fontDescriptor->data, __FILE__, __LINE__); // FONTMGR.C, 268 goto err; }