fixup! refactor: tr_completion (#2220) (#2228)

fix off-by-one
This commit is contained in:
Charles Kerr 2021-11-25 16:13:21 -06:00 committed by GitHub
parent 3d2fa18c61
commit 72cae4996f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1292,7 +1292,7 @@ static uint64_t countFileBytesCompleted(tr_torrent const* tor, tr_file_index_t i
}
// the middle blocks
if (begin + 1 < end)
if (end - begin > 2)
{
uint64_t u = tor->completion.blocks().count(begin + 1, end - 1);
u *= tor->block_size;