diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 25370bdb1..78397b6dd 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -3104,7 +3104,8 @@ namespace libtorrent } } - TORRENT_ASSERT(verify_piece(r)); + // the verification will fail for coalesced blocks + TORRENT_ASSERT(verify_piece(r) || m_request_large_blocks); #ifndef TORRENT_DISABLE_EXTENSIONS bool handled = false; diff --git a/src/torrent.cpp b/src/torrent.cpp index 493d37740..a9cbb33e3 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -817,6 +817,13 @@ namespace libtorrent return; } + if (m_torrent_file->num_pieces() == 0) + { + set_error(errors::torrent_invalid_length, ""); + pause(); + return; + } + // the shared_from_this() will create an intentional // cycle of ownership, se the hpp file for description. m_owning_storage = new piece_manager(shared_from_this(), m_torrent_file