fix regression in torrent size check

This commit is contained in:
arvidn 2017-10-01 11:39:06 +02:00 committed by Arvid Norberg
parent 33b03e1f8e
commit c0d76a5304
3 changed files with 3 additions and 1 deletions

View File

@ -1013,7 +1013,8 @@ namespace {
// we want this division to round upwards, that's why we have the
// extra addition
if (files.total_size() >= std::numeric_limits<int>::max()
if (files.total_size() >=
(std::numeric_limits<std::int64_t>::max() / files.piece_length())
- files.piece_length())
{
ec = errors::too_many_pieces_in_torrent;

View File

@ -126,6 +126,7 @@ static test_torrent_t test_torrents[] =
{ "unordered.torrent" },
{ "symlink_zero_size.torrent" },
{ "pad_file_no_path.torrent" },
{ "large.torrent" },
};
struct test_failing_torrent_t

Binary file not shown.