mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
Fix: Corrupted savegame could cause heap corruption by writing outside link graph edge matrix. (#9046)
This commit is contained in:
parent
da55286c2c
commit
aade177d79
@ -151,6 +151,7 @@ void SaveLoad_LinkGraph(LinkGraph &lg)
|
|||||||
} else {
|
} else {
|
||||||
/* ... but as that wasted a lot of space we save a sparse matrix now. */
|
/* ... but as that wasted a lot of space we save a sparse matrix now. */
|
||||||
for (NodeID to = from; to != INVALID_NODE; to = lg.edges[from][to].next_edge) {
|
for (NodeID to = from; to != INVALID_NODE; to = lg.edges[from][to].next_edge) {
|
||||||
|
if (to >= size) SlErrorCorrupt("Link graph structure overflow");
|
||||||
SlObject(&lg.edges[from][to], _edge_desc);
|
SlObject(&lg.edges[from][to], _edge_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user