From 5e254ffea60e79f1f096e03fa786feae0c137293 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 23 Sep 2006 21:43:26 +0000 Subject: [PATCH] fixede bug appearing when loading a torrent containing a piece length of 0 --- ChangeLog | 1 + src/torrent_info.cpp | 1 + 2 files changed, 2 insertions(+) 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"))