From fc284c746040f9b55d9e283ccc9916b19a4cf7d1 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 10:01:36 -0700 Subject: [PATCH] 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. --- tools/editor/editor_project.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/editor/editor_project.cpp b/tools/editor/editor_project.cpp index a8ae327a..3dcc52fb 100644 --- a/tools/editor/editor_project.cpp +++ b/tools/editor/editor_project.cpp @@ -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);