fix to bound check piece index before use in incoming_allowed_fast
This commit is contained in:
parent
f6b34b7f0b
commit
456f8f8677
|
@ -1620,12 +1620,6 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
#endif
|
#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()))
|
if (index < 0 || index >= int(m_have_piece.size()))
|
||||||
{
|
{
|
||||||
#ifdef TORRENT_VERBOSE_LOGGING
|
#ifdef TORRENT_VERBOSE_LOGGING
|
||||||
|
@ -1635,6 +1629,12 @@ namespace libtorrent
|
||||||
return;
|
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);
|
m_allowed_fast.push_back(index);
|
||||||
|
|
||||||
// if the peer has the piece and we want
|
// if the peer has the piece and we want
|
||||||
|
|
Loading…
Reference in New Issue