diff --git a/ChangeLog b/ChangeLog index ad8545970..8593a2f36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * fixed bug causing a crash with a torrent with piece length 0 * added an extension to the DHT network protocol to support the exchange of nodes with IPv6 addresses. * modified the ip_filter api slightly to support IPv6 diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index 6499574df..401c25df7 100755 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -207,6 +207,7 @@ namespace libtorrent // extract piece length m_piece_length = (int)info["piece length"].integer(); + if (m_piece_length <= 0) throw std::runtime_error("invalid torrent. piece length <= 0"); // extract file name (or the directory name if it's a multifile libtorrent) if (entry const* e = info.find_key("name.utf-8"))