1
0
Fork 0

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

pull/7632/head
PeterN 2019-04-20 02:34:25 +01:00 committed by Charles Pigott
parent e38a4e1e57
commit 60cbcf0742
1 changed files with 2 additions and 1 deletions

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();