diff options
author | rubidium <rubidium@openttd.org> | 2011-11-20 15:17:34 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-11-20 15:17:34 +0000 |
commit | 18a0dc894d49ff1b141adbac13845999ad7541a7 (patch) | |
tree | c23b6e4fc72e60870ba84bc4880805927d3b0e74 /src | |
parent | 107f67bfa46daf47916c761b755202ff1e578cba (diff) | |
download | openttd-18a0dc894d49ff1b141adbac13845999ad7541a7.tar.xz |
(svn r23283) -Fix: [NewGRF] Prevent against writing data for unknown fonts
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index d8950fa39..5aee0f5d3 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -6886,7 +6886,7 @@ static void LoadFontGlyph(ByteReader *buf) /* <12> <num_def> <font_size> <num_char> <base_char> * * B num_def Number of definitions - * B font_size Size of font (0 = normal, 1 = small, 2 = large) + * B font_size Size of font (0 = normal, 1 = small, 2 = large, 3 = mono) * B num_char Number of consecutive glyphs * W base_char First character index */ @@ -6897,10 +6897,14 @@ static void LoadFontGlyph(ByteReader *buf) uint8 num_char = buf->ReadByte(); uint16 base_char = buf->ReadWord(); + if (size >= FS_END) { + grfmsg(1, "LoadFontGlyph: Size %u is not supported, ignoring", size); + } + grfmsg(7, "LoadFontGlyph: Loading %u glyph(s) at 0x%04X for size %u", num_char, base_char, size); for (uint c = 0; c < num_char; c++) { - SetUnicodeGlyph(size, base_char + c, _cur.spriteid); + if (size < FS_END) SetUnicodeGlyph(size, base_char + c, _cur.spriteid); _cur.nfo_line++; LoadNextSprite(_cur.spriteid++, _cur.file_index, _cur.nfo_line); } |