From fa9bf5afc88accdb727fd61da5f311e871b7759b Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Mon, 1 Oct 2007 02:20:03 +0000 Subject: [PATCH] add valid fast check --- libtorrent/src/peer_connection.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libtorrent/src/peer_connection.cpp b/libtorrent/src/peer_connection.cpp index 535a90142..5ef96ec5b 100755 --- a/libtorrent/src/peer_connection.cpp +++ b/libtorrent/src/peer_connection.cpp @@ -1597,6 +1597,15 @@ namespace libtorrent && t->have_piece(index)) return; + if (index < 0 || index >= int(m_have_piece.size())) + { +#ifdef TORRENT_VERBOSE_LOGGING + (*m_logger) << time_now_string() << " <== INVALID_ALLOWED_FAST [ " << index << " | s: " + << int(m_have_piece.size()) << " ]\n"; +#endif + return; + } + m_allowed_fast.push_back(index); // if the peer has the piece and we want @@ -3021,3 +3030,4 @@ namespace libtorrent } } +