From d02ee3ed241da12aefa938ac0b65ead1f2edd498 Mon Sep 17 00:00:00 2001 From: deep <166912166+deep9977@users.noreply.github.com> Date: Sun, 3 Nov 2024 09:49:33 +0000 Subject: [PATCH] Added check to make sure hash is valid hex (#153) --- src/project_parser.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/project_parser.cpp b/src/project_parser.cpp index b1ceea6..a9be666 100644 --- a/src/project_parser.cpp +++ b/src/project_parser.cpp @@ -550,6 +550,14 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p algo.push_back(ch); } key = "URL_HASH"; + if (value.empty()) { + throw_key_error("Empty hash value", argItr.first, argItr.second); + } + for (char c : value) { + if (!std::isxdigit(c)) { + throw_key_error("Hash value must be a hex string", argItr.first, argItr.second); + } + } value = algo + "=" + value; } else if (key == "hash") { key = "URL_HASH";