From 0da7de19fc5e0c5b0647a99d07ff4a5c58a07879 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 6 Dec 2024 18:21:22 +0100 Subject: [PATCH] Gvas: fix some JSON!MASS fuckery. To the community: I know VD didn't properly QA it, but please, be careful with the system! --- src/Gvas/Serialisers/StringProperty.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Gvas/Serialisers/StringProperty.cpp b/src/Gvas/Serialisers/StringProperty.cpp index c9e36f0..9fca2d1 100644 --- a/src/Gvas/Serialisers/StringProperty.cpp +++ b/src/Gvas/Serialisers/StringProperty.cpp @@ -45,7 +45,17 @@ StringProperty::deserialise(Containers::StringView name, Containers::StringView } } - if(!reader.readUEString(prop->value)) { + if(value_length == 4) { + // MASS files (the JSON-based sharing system VD made) have a bug that allows importing weapons of a type in + // another weapon array. It can lead to more serious issues, like weapon names being empty. The code below is an + // attempt to work around that particular issue. + LOG_WARNING_FORMAT("Property {} has an invalid value size {}. Working around it. Please do an action that leads to a write operation.", name, value_length); + value_length++; + prop->value = ""; + std::uint32_t dummy_u32; + reader.readUint32(dummy_u32); + } + else if(!reader.readUEString(prop->value)) { LOG_ERROR_FORMAT("Couldn't read string property {}'s value.", name); return nullptr; }