Skip to content

Commit d02ee3e

Browse files
authored
Added check to make sure hash is valid hex (#153)
1 parent 87c0295 commit d02ee3e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/project_parser.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,14 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
550550
algo.push_back(ch);
551551
}
552552
key = "URL_HASH";
553+
if (value.empty()) {
554+
throw_key_error("Empty hash value", argItr.first, argItr.second);
555+
}
556+
for (char c : value) {
557+
if (!std::isxdigit(c)) {
558+
throw_key_error("Hash value must be a hex string", argItr.first, argItr.second);
559+
}
560+
}
553561
value = algo + "=" + value;
554562
} else if (key == "hash") {
555563
key = "URL_HASH";

0 commit comments

Comments
 (0)