diff --git a/ChangeLog b/ChangeLog index f4e4b9a52..f1be43032 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ * fix uTP edge case where udp socket buffer fills up * fix nagle implementation in uTP + * fixed crash with empty url-lists in torrent files * added missing max_connections() function to python bindings 0.16.7 release diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index e3b3d391a..fb574b54a 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -1193,7 +1193,7 @@ namespace libtorrent // if there are any url-seeds, extract them lazy_entry const* url_seeds = torrent_file.dict_find("url-list"); - if (url_seeds && url_seeds->type() == lazy_entry::string_t) + if (url_seeds && url_seeds->type() == lazy_entry::string_t && url_seeds->string_length() > 0) { web_seed_entry ent(maybe_url_encode(url_seeds->string_value()) , web_seed_entry::url_seed); @@ -1206,6 +1206,7 @@ namespace libtorrent { lazy_entry const* url = url_seeds->list_at(i); if (url->type() != lazy_entry::string_t) continue; + if (url->string_length() == 0) continue; web_seed_entry ent(maybe_url_encode(url->string_value()) , web_seed_entry::url_seed); if (m_multifile && ent.url[ent.url.size()-1] != '/') ent.url += '/'; @@ -1215,7 +1216,7 @@ namespace libtorrent // if there are any http-seeds, extract them lazy_entry const* http_seeds = torrent_file.dict_find("httpseeds"); - if (http_seeds && http_seeds->type() == lazy_entry::string_t) + if (http_seeds && http_seeds->type() == lazy_entry::string_t && http_seeds->string_length() > 0) { m_web_seeds.push_back(web_seed_entry(maybe_url_encode(http_seeds->string_value()) , web_seed_entry::http_seed)); @@ -1225,7 +1226,7 @@ namespace libtorrent for (int i = 0, end(http_seeds->list_size()); i < end; ++i) { lazy_entry const* url = http_seeds->list_at(i); - if (url->type() != lazy_entry::string_t) continue; + if (url->type() != lazy_entry::string_t || url->string_length() == 0) continue; m_web_seeds.push_back(web_seed_entry(maybe_url_encode(url->string_value()) , web_seed_entry::http_seed)); }