Changeset - r25189:6e7e41d05411
[Not reviewed]
master
0 1 0
Milek7 - 3 years ago 2021-04-17 18:19:37
Milek7@users.noreply.github.com
Fix: Corrupted savegame could cause heap corruption by writing outside link graph edge matrix. (#9046)
1 file changed with 1 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/saveload/linkgraph_sl.cpp
Show inline comments
 
@@ -148,12 +148,13 @@ void SaveLoad_LinkGraph(LinkGraph &lg)
 
			for (NodeID to = 0; to < size; ++to) {
 
				SlObject(&lg.edges[from][to], _edge_desc);
 
			}
 
		} 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);
 
			}
 
		}
 
	}
 
}
 

	
0 comments (0 inline, 0 general)