mirror of
https://github.com/transmission/transmission
synced 2025-02-19 04:41:11 +00:00
fix: integer overflow when calculating sizeWhenDone
(#2378)
While the function correctly returns a `uint64_t`, internally a `size_t` variable is used to calculate the accumulated size. On 32-bit systems (e.g. Raspbian) `size_t` is only 32-bit wide, causing overflow for torrents > 4GB.
This commit is contained in:
parent
a5c6168805
commit
319312596a
1 changed files with 1 additions and 1 deletions
|
@ -56,7 +56,7 @@ uint64_t tr_completion::computeSizeWhenDone() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// count bytes that we want or that we already have
|
// count bytes that we want or that we already have
|
||||||
auto size = size_t{ 0 };
|
auto size = uint64_t{ 0 };
|
||||||
for (tr_piece_index_t piece = 0; piece < block_info_->n_pieces; ++piece)
|
for (tr_piece_index_t piece = 0; piece < block_info_->n_pieces; ++piece)
|
||||||
{
|
{
|
||||||
if (tor_->pieceIsWanted(piece))
|
if (tor_->pieceIsWanted(piece))
|
||||||
|
|
Loading…
Reference in a new issue