mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-11 16:54:42 +00:00
Fix: Bounds check access to railtype_map. (#7529)
This commit is contained in:
parent
d2b6176cdf
commit
be073b46da
@ -5478,7 +5478,8 @@ static void RailTypeMapSpriteGroup(ByteReader *buf, uint8 idcount)
|
|||||||
{
|
{
|
||||||
uint8 *railtypes = AllocaM(uint8, idcount);
|
uint8 *railtypes = AllocaM(uint8, idcount);
|
||||||
for (uint i = 0; i < idcount; i++) {
|
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();
|
uint8 cidcount = buf->ReadByte();
|
||||||
|
Loading…
Reference in New Issue
Block a user