diff --git a/minipp/minipp.hpp b/minipp/minipp.hpp index 912c398..02fa61a 100644 --- a/minipp/minipp.hpp +++ b/minipp/minipp.hpp @@ -547,7 +547,16 @@ minipp::EResult minipp::MiniPPFile::Values::ArrayValue::Parse(const std::string& if (isInString) { if (c == '\\') + { + if (i + 1 >= str.size()) + { + PP_COUT("Syntax error: Bad escape sequence: '\\' at end of string"); + return EResult::FormatError; + } + currentElement += c; + currentElement += str[i + 1]; ++i; + } else if (c == '"') { isInString = false; diff --git a/minipp/test.mini b/minipp/test.mini index 7c63239..94202f7 100644 --- a/minipp/test.mini +++ b/minipp/test.mini @@ -1,10 +1,11 @@ [game] -name = "Test Game" +name = "Test Game\nNext Line" version = "1.0.0" year = 2025 completionPercentage = 50.0f # Should only be true if completionPercentage is 100 is_completed = false +testargs = ["this is a \"test\"", "this is\n the next line"] # This section is about # the settings of a game window diff --git a/minipp/test_out.mini b/minipp/test_out.mini index a3e12e7..6fc1222 100644 --- a/minipp/test_out.mini +++ b/minipp/test_out.mini @@ -1,7 +1,8 @@ [game] -name = "Test Game" +name = "Test Game\nNext Line" completionPercentage = 50.000000 version = "1.0.0" +testargs = ["this is a \"test\"", "this is\n the next line"] year = 2025 # Should only be true if completionPercentage is 100 is_completed = false