Changeset 12428


Ignore:
Timestamp:
May 12, 2011, 6:43:40 AM (10 years ago)
Author:
jordan
Message:

(trunk libT) fix magnet link crash in peer-msgs.c's updateDesiredRequestCount() reported by quinx in the forums.

In some odd cases (such as if unchoked without having shown interest), the code could dividing a number by the torrent's block size without checking to see if the torrent had its metadata yet. This caused a division by zero because a magnet torrent's blocksize is unset until the metadata is downloaded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-msgs.c

    r12411 r12428  
    16641664    const tr_torrent * const torrent = msgs->torrent;
    16651665
    1666     if( tr_torrentIsSeed( msgs->torrent ) )
    1667     {
    1668         msgs->desiredRequestCount = 0;
    1669     }
    1670     else if( msgs->peer->clientIsChoked )
    1671     {
    1672         msgs->desiredRequestCount = 0;
    1673     }
    1674     else if( !msgs->peer->clientIsInterested )
     1666   
     1667    /* there are lots of reasons we might not want to request any blocks... */
     1668    if( tr_torrentIsSeed( torrent ) || !tr_torrentHasMetadata( torrent )
     1669                                    || msgs->peer->clientIsChoked
     1670                                    || !msgs->peer->clientIsInterested )
    16751671    {
    16761672        msgs->desiredRequestCount = 0;
Note: See TracChangeset for help on using the changeset viewer.