1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-27 08:29:11 +00:00

Fix: Bounds check access to railtype_map. (#7529)

This commit is contained in:
2019-04-20 02:34:25 +01:00
committed by Charles Pigott
parent e38a4e1e57
commit 60cbcf0742

View File

@@ -5480,7 +5480,8 @@ static void RailTypeMapSpriteGroup(ByteReader *buf, uint8 idcount)
{
uint8 *railtypes = AllocaM(uint8, idcount);
for (uint i = 0; i < idcount; i++) {
railtypes[i] = _cur.grffile->railtype_map[buf->ReadByte()];
uint8 id = buf->ReadByte();
railtypes[i] = id < RAILTYPE_END ? _cur.grffile->railtype_map[id] : INVALID_RAILTYPE;
}
uint8 cidcount = buf->ReadByte();