Fix another integer overflow bug on 32-bit platforms with torrents > 4GB (#2391)

This commit is contained in:
Frank Aurich 2022-01-13 05:52:36 +01:00 committed by GitHub
parent b0ee4007ff
commit 41b2a802cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -192,7 +192,7 @@ uint64_t tr_completion::countHasBytesInBlocks(tr_block_span_t span) const
{
auto const [begin, end] = span;
auto n = blocks_.count(begin, end);
uint64_t n = blocks_.count(begin, end);
n *= block_info_->block_size;
if (end == block_info_->n_blocks && blocks_.test(end - 1))

View File

@ -59,7 +59,7 @@ TEST_F(CompletionTest, MagnetLink)
TEST_F(CompletionTest, setBlocks)
{
auto constexpr TotalSize = uint64_t{ BlockSize * 4096 };
auto constexpr TotalSize = uint64_t{ BlockSize * 64 * 50000 }; // 50GB
auto constexpr PieceSize = uint64_t{ BlockSize * 64 };
auto torrent = TestTorrent{};
@ -294,7 +294,7 @@ TEST_F(CompletionTest, leftUntilDone)
TEST_F(CompletionTest, sizeWhenDone)
{
auto torrent = TestTorrent{};
auto constexpr TotalSize = uint64_t{ BlockSize * 4096 } + 1;
auto constexpr TotalSize = uint64_t{ BlockSize * 64 * 50000 }; // 50GB
auto constexpr PieceSize = uint64_t{ BlockSize * 64 };
auto const block_info = tr_block_info{ TotalSize, PieceSize };