mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
#589 fix crash that occurred when the next-to-last file in a torrent ended on a piece boundary and the last file had a size of 0 bytes.
This commit is contained in:
parent
2f3d027d04
commit
549778dc7e
2 changed files with 5 additions and 1 deletions
|
@ -266,7 +266,7 @@ checkFile( tr_torrent * tor,
|
|||
tr_buildPath ( path, sizeof(path), tor->destination, file->name, NULL );
|
||||
nofile = stat( path, &sb ) || !S_ISREG( sb.st_mode );
|
||||
|
||||
for( i=file->firstPiece; i<=file->lastPiece && (!*abortFlag); ++i )
|
||||
for( i=file->firstPiece; i<=file->lastPiece && i<tor->info.pieceCount && (!*abortFlag); ++i )
|
||||
{
|
||||
if( nofile )
|
||||
{
|
||||
|
|
|
@ -810,6 +810,10 @@ tr_torrentSetHasPiece( tr_torrent * tor, int pieceIndex, int has )
|
|||
{
|
||||
tr_torrentLock( tor );
|
||||
|
||||
assert( tor != NULL );
|
||||
assert( pieceIndex >= 0 );
|
||||
assert( pieceIndex < tor->info.pieceCount );
|
||||
|
||||
if( has )
|
||||
tr_cpPieceAdd( tor->completion, pieceIndex );
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue