fixed assert in ut_metadata plugin
This commit is contained in:
parent
deb363e53b
commit
2897389409
|
@ -97,6 +97,7 @@ release 0.14.7
|
||||||
* fixed bug in error handling when parsing torrent files
|
* fixed bug in error handling when parsing torrent files
|
||||||
* fixed file checking bug when renaming a file before checking the torrent
|
* fixed file checking bug when renaming a file before checking the torrent
|
||||||
* fixed race conditon when receiving metadata from swarm
|
* fixed race conditon when receiving metadata from swarm
|
||||||
|
* fixed assert in ut_metadata plugin
|
||||||
|
|
||||||
release 0.14.6
|
release 0.14.6
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,18 @@ namespace libtorrent { namespace
|
||||||
if (piece < 0 || piece >= int(m_requested_metadata.size()))
|
if (piece < 0 || piece >= int(m_requested_metadata.size()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TORRENT_ASSERT(piece * 16 * 1024 + size <= m_metadata_size);
|
if (total_size != m_metadata_size)
|
||||||
|
{
|
||||||
|
// they disagree about the size!
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (piece * 16 * 1024 + size > m_metadata_size)
|
||||||
|
{
|
||||||
|
// this piece is invalid
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::memcpy(&m_metadata[piece * 16 * 1024], buf, size);
|
std::memcpy(&m_metadata[piece * 16 * 1024], buf, size);
|
||||||
// mark this piece has 'have'
|
// mark this piece has 'have'
|
||||||
m_requested_metadata[piece] = (std::numeric_limits<int>::max)();
|
m_requested_metadata[piece] = (std::numeric_limits<int>::max)();
|
||||||
|
|
Loading…
Reference in New Issue