Fix: Corrupted savegame could cause heap corruption by writing outside link graph edge matrix. (#9046)

This commit is contained in:
Milek7 2021-04-17 20:19:37 +02:00 committed by GitHub
parent da55286c2c
commit aade177d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -151,6 +151,7 @@ void SaveLoad_LinkGraph(LinkGraph &lg)
} else {
/* ... 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) {
if (to >= size) SlErrorCorrupt("Link graph structure overflow");
SlObject(&lg.edges[from][to], _edge_desc);
}
}