From 3a93e1767ba46061e755b96ccbe1c610c38bad64 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Fri, 24 Feb 2017 14:24:07 -0500 Subject: [PATCH] fixing sign issues in peer_connection::send_allowed_set --- src/peer_connection.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 345b85922..05b313801 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -547,7 +547,7 @@ namespace libtorrent } int const num_allowed_pieces = m_settings.get_int(settings_pack::allowed_fast_set_size); - if (num_allowed_pieces == 0) return; + if (num_allowed_pieces <= 0) return; if (!t->valid_metadata()) return; @@ -605,7 +605,8 @@ namespace libtorrent for (int i = 0; i < int(hash.size() / sizeof(std::uint32_t)); ++i) { ++loops; - piece_index_t const piece(detail::read_uint32(p) % num_pieces); + TORRENT_ASSERT(num_pieces > 0); + piece_index_t const piece(int(detail::read_uint32(p) % std::uint32_t(num_pieces))); if (std::find(m_accept_fast.begin(), m_accept_fast.end(), piece) != m_accept_fast.end()) {