{"record":{"id":"5c2ddf20ccbd858f","repo":"Anuken/Mindustry","slug":"objective-marker-too-long","errorCode":null,"errorMessage":"Objective marker too long","messagePattern":"Objective marker too long","errorType":"exception","errorClass":"ArcRuntimeException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/io/TypeIO.java","lineNumber":956,"sourceCode":"    }\n\n    public static MapObjectives readObjectives(Reads read){\n        int length = read.i();\n        if(length >= 60_000) throw new RuntimeException(\"Objectives bytes too long: \" + length);\n        String string = new String(read.b(new byte[length]), charset);\n        return JsonIO.read(MapObjectives.class, string);\n    }\n\n    public static void writeObjectiveMarker(Writes write, ObjectiveMarker marker){\n        String string = JsonIO.json.toJson(marker, MapObjectives.ObjectiveMarker.class);\n        byte[] bytes = string.getBytes(charset);\n        write.i(bytes.length);\n        write.b(bytes);\n    }\n\n    public static ObjectiveMarker readObjectiveMarker(Reads read){\n        int length = read.i();\n        if(length > maxByteArraySize) throw new ArcRuntimeException(\"Objective marker too long\");\n        String string = new String(read.b(new byte[length]), charset);\n        return JsonIO.read(MapObjectives.ObjectiveMarker.class, string);\n    }\n\n    public static void writeVecNullable(Writes write, @Nullable Vec2 v){\n        if(v == null){\n            write.f(Float.NaN);\n            write.f(Float.NaN);\n        }else{\n            write.f(v.x);\n            write.f(v.y);\n        }\n    }\n\n    public static @Nullable Vec2 readVecNullable(Reads read){\n        float x = read.f(), y = read.f();\n        return Float.isNaN(x) || Float.isNaN(y) ? null : new Vec2(x, y);\n    }","sourceCodeStart":938,"sourceCodeEnd":974,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/io/TypeIO.java#L938-L974","documentation":"readObjectiveMarker() reads a JSON ObjectiveMarker. It reads a 4-byte length and throws ArcRuntimeException if length > maxByteArraySize (40_000). It bounds the marker payload.","triggerScenarios":"An objective-marker packet whose int length field exceeds 40_000.","commonSituations":"Oversized marker data; a mod embedding large blobs in a marker; corruption.","solutions":["Keep marker JSON under 40KB.","Trim the marker payload; move large data elsewhere."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before writing a marker, check serialized size against the read cap.\nString json = JsonIO.json.toJson(marker, MapObjectives.ObjectiveMarker.class);\nif(json.getBytes(java.nio.charset.StandardCharsets.UTF_8).length > 40_000){\n    throw new IllegalStateException(\"Objective marker too large\");\n}","typeGuard":null,"tryCatchPattern":"try { ObjectiveMarker m = TypeIO.readObjectiveMarker(read); }\ncatch(ArcRuntimeException e){ Log.err(\"Marker payload too large\", e); /* handle */ }","preventionTips":["Keep objective-marker JSON under 40KB.","Avoid embedding large blobs in markers."],"tags":["network","objectives","deserialization","security"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}