add assert to detect index out-of-range

This commit is contained in:
Steven Siloti 2016-10-24 20:48:57 -07:00 committed by Arvid Norberg
parent f16d0b7953
commit 241e9fd25a
1 changed files with 2 additions and 0 deletions

View File

@ -334,6 +334,8 @@ namespace libtorrent
end = int(p->blocks_in_piece);
}
TORRENT_ASSERT(end <= p->blocks_in_piece);
// count number of blocks that would be flushed
int num_blocks = 0;
for (int i = end-1; i >= 0; --i)