fix(project): cap zones at 1024 on project load

Same defense pattern as the other editor JSON loaders. WoW only
supports 65535 maps total and the editor loads one tile at a
time; 1024 zones per project is plenty. Stale autosave or hand-
edit could otherwise grow zones unbounded and slow the project
picker UI.
This commit is contained in:
Kelsi 2026-05-06 10:01:36 -07:00
parent ffc0862977
commit fc284c7460

View file

@ -55,7 +55,17 @@ bool EditorProject::load(const std::string& path) {
zones.clear();
if (j.contains("zones") && j["zones"].is_array()) {
// Cap project zones — same defense pattern as the other
// editor JSON loaders. WoW only supports 65535 maps total
// and the editor loads one tile at a time, so 1024 zones
// per project is plenty.
constexpr size_t kMaxZones = 1024;
for (const auto& jz : j["zones"]) {
if (zones.size() >= kMaxZones) {
LOG_WARNING("Project zone cap reached (", kMaxZones,
") — remaining entries dropped");
break;
}
ProjectZone z;
z.mapName = jz.value("mapName", "");
z.tileX = jz.value("tileX", 32);