From 2576a28f73f0f345dfa6fff745fb163efb3bde6c Mon Sep 17 00:00:00 2001 From: Janrupf Date: Sat, 6 Nov 2021 22:20:26 +0100 Subject: [PATCH 1/2] NOISSUE Exclude run directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index bb82c254..f0336b63 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ tags branding/ secrets/ +run/ From 0423464b88a0d25442fbb50f4b94db73757b6126 Mon Sep 17 00:00:00 2001 From: Janrupf Date: Sat, 6 Nov 2021 22:42:10 +0100 Subject: [PATCH 2/2] GH-4227 Don't blindly trust mods.toml to be valid --- launcher/minecraft/mod/LocalModParseTask.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/launcher/minecraft/mod/LocalModParseTask.cpp b/launcher/minecraft/mod/LocalModParseTask.cpp index 0d6972fb..8ac5885f 100644 --- a/launcher/minecraft/mod/LocalModParseTask.cpp +++ b/launcher/minecraft/mod/LocalModParseTask.cpp @@ -107,8 +107,19 @@ std::shared_ptr ReadMCModTOML(QByteArray contents) // array defined by [[mods]] toml_array_t* tomlModsArr = toml_array_in(tomlData, "mods"); + if(!tomlModsArr) + { + qWarning() << "Corrupted mods.toml? Couldn't find [[mods]] array!"; + return nullptr; + } + // we only really care about the first element, since multiple mods in one file is not supported by us at the moment toml_table_t* tomlModsTable0 = toml_table_at(tomlModsArr, 0); + if(!tomlModsTable0) + { + qWarning() << "Corrupted mods.toml? [[mods]] didn't have an element at index 0!"; + return nullptr; + } // mandatory properties - always in [[mods]] toml_datum_t modIdDatum = toml_string_in(tomlModsTable0, "modId");