1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-22 15:54:57 +00:00

fix: "Nullptr with nonzero offset" (#3941)

This commit is contained in:
A Cœur 2022-10-12 05:52:13 +08:00 committed by GitHub
parent 4f957657d1
commit 33afdc32f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -211,7 +211,10 @@ int readOrWritePiece(tr_torrent* tor, IoMode io_mode, tr_block_info::Location lo
uint64_t const bytes_this_pass = std::min(uint64_t{ buflen }, uint64_t{ tor->fileSize(file_index) - file_offset }); uint64_t const bytes_this_pass = std::min(uint64_t{ buflen }, uint64_t{ tor->fileSize(file_index) - file_offset });
err = readOrWriteBytes(tor->session, tor, io_mode, file_index, file_offset, buf, bytes_this_pass); err = readOrWriteBytes(tor->session, tor, io_mode, file_index, file_offset, buf, bytes_this_pass);
buf += bytes_this_pass; if (buf != nullptr)
{
buf += bytes_this_pass;
}
buflen -= bytes_this_pass; buflen -= bytes_this_pass;
if (err != 0 && io_mode == IoMode::Write && tor->error != TR_STAT_LOCAL_ERROR) if (err != 0 && io_mode == IoMode::Write && tor->error != TR_STAT_LOCAL_ERROR)