-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix assertion fail #10638
Fix assertion fail #10638
Conversation
fa0ad50
to
e391a69
Compare
src/base/bittorrent/torrentinfo.cpp
Outdated
|
||
const int begin = static_cast<int>(fileOffset / pieceLength()); | ||
const int end = (fileSize > 0) ? static_cast<int>((fileOffset + fileSize - 1) / pieceLength()) | ||
: begin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait... If file has size of 0 then it has no pieces, isn't it? So you need to return some kind of invalid PieceRange. Or am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested, for a file with fileSize == 0
, fileOffset
is 0
.
so I think it should still return valid PieceRange.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested, for a file with fileSize == 0, fileOffset is 0.
But it still has no pieces, isn't it? If you return [0; 0] range it means the file has 1 piece. Seems incorrect to me...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this part, these code are convoluted...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but you didn't fix zero-sized files. It still here.
Apparently, the problem is a little more complicated than it seems...
Nevermind. I was confused by the jumble of IndexInterval and IndexRange in this code.
490617a
to
9dd6136
Compare
2108a66
to
55e8ca6
Compare
When fileSize == 0, the second index could be smaller than the first index, thus trigger the assert check in IndexInterval constructor. Closes qbittorrent#10611.
When fileSize == 0, the second index could be smaller than the first index, thus trigger the
assert check in IndexInterval constructor.
Closes #10611.
Will backport to v4_1_x.