Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 190917 - Tracker announce returns invalid bencode
Summary: Tracker announce returns invalid bencode
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Infrastructure
Classification: Unclassified
Component: [OLD] BitTorrent services at http://torrents.gentoo.org (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Infrastructure
URL: http://torrents.gentoo.org/tracker.ph...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-31 22:15 UTC by lihalla
Modified: 2007-09-01 12:11 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Tracker's response (gentoo-tracker,3.29 KB, application/octet-stream)
2007-08-31 22:17 UTC, lihalla
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lihalla 2007-08-31 22:15:10 UTC
I've tried to get peer list downloading torrent livecd-i686-installer-2007.0.torrent with the URL http://torrents.gentoo.org/tracker.php/announce?downloaded=0&event=started&info_hash=%AC%F6%06%0E%BE%87%09D0x%C0%D1zzmb%FB%8A%9E%03&left=734050205&peer_id=I010-----Eg%3AH%3Ak%00hhpo&port=7996&uploaded=0 but it returns invalid data: the bencode is malformed. It seems that one peer id is shorter (19 bytes) than it is reported to be (20 bytes) and thus the following data are invalid.

Reproducible: Sometimes

Steps to Reproduce:
1. Get peer list with the mentioned URL.
Comment 1 lihalla 2007-08-31 22:17:52 UTC
Created attachment 129720 [details]
Tracker's response

Bencode is corrupted at position 426 (counting from 0) because previous string in the list is shorter than it should be.
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-08-31 23:15:30 UTC
position 426 (hex offset 0x1AA) in the attached file is a port number, not a peerid.
Comment 3 lihalla 2007-09-01 09:08:30 UTC
(In reply to comment #2)
> position 426 (hex offset 0x1AA) in the attached file is a port number, not a
> peerid.

At this position is the character ":" that separates string length (the preceeding number, in this case 4, and the string itself). But length of the string cannot be decoded because this 4 still belongs to the preceeding string (which has length 20 and contents "-BC0070-???B%????)?4"). You see that there is "4" at the end but there should be one other character because 4 is length of the following string ("port").

It is obvious that peer ids in the list are corrupted because no BitTorrent client would use so much of "?" in its peer id. It looks to me like some decoding/encoding problem.
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-09-01 10:32:46 UTC
I'm not sure why it cut things off there, but regardless, the client with that peerid is not on that torrent anymore.

Comment 5 lihalla 2007-09-01 12:11:12 UTC
I've looked at phpbttracker+ code and it seems ok. So I've tried something else. If you download http://torrents.gentoo.org/tracker.php/announce?downloaded=0&event=started&info_hash=%FE%BFR%1C%40%2E%AD%BD%C2%DC%B05%F7%E98%B3M%B6%7C%7E&left=28518164&peer_id=test-%79%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d&port=7996&uploaded=0 (peer list for torrent stage1-sh4-2007.0) you see that peer id that begins with test- doesn't match what was supplied in the url (test-%79%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d). It seems that characters with value >= 0x80 are turned into "?". And the id also seems to be truncated.

It may be caused by conversion to iso-8859-1 encoding. It is also interesting that this conversion doesn't happen when compact format is used (compact=1 in the URL).