From 93d0ab797b58c4ce19a03fac15fcf53045c91d2b Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Wed, 19 Dec 2007 07:06:10 +0000 Subject: [PATCH] lt fix - fix to bound check piece index before use in incoming_allowed_fast --- libtorrent/src/peer_connection.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libtorrent/src/peer_connection.cpp b/libtorrent/src/peer_connection.cpp index f99839191..e63788d0f 100755 --- a/libtorrent/src/peer_connection.cpp +++ b/libtorrent/src/peer_connection.cpp @@ -1614,12 +1614,6 @@ namespace libtorrent } #endif - // if we already have the piece, we can - // ignore this message - if (t->valid_metadata() - && t->have_piece(index)) - return; - if (index < 0 || index >= int(m_have_piece.size())) { #ifdef TORRENT_VERBOSE_LOGGING @@ -1629,6 +1623,12 @@ namespace libtorrent return; } + // if we already have the piece, we can + // ignore this message + if (t->valid_metadata() + && t->have_piece(index)) + return; + m_allowed_fast.push_back(index); // if the peer has the piece and we want