Fix core subsystem logic and safety bugs @Sirus20x6

This commit is contained in:
Jari Sundell
2026-04-17 18:54:46 +02:00
committed by GitHub
parent 4235507292
commit 1adcf230d2
10 changed files with 43 additions and 23 deletions
+3 -2
View File
@@ -238,9 +238,10 @@ is_data_uri(const std::string& uri) {
std::string
decode_data_uri(const std::string& uri) {
const auto start = uri.find("base64,", 5) + 7;
if (start == std::string::npos)
const auto pos = uri.find("base64,", 5);
if (pos == std::string::npos)
throw torrent::input_error("Invalid data uri: not base64 encoded.");
const auto start = pos + 7;
if (start >= uri.size())
throw torrent::input_error("Empty base64.");
return utils::decode_base64(uri.substr(start));