Transmission: [BUG] libtransmission cannot parse hybrid torrent files

Created on 25 Jun 2020  ·  2Comments  ·  Source: transmission/transmission

BEP 52 sets out the upgrade path towards BitTorrent v2, and this describes so-called "hybrid" torrents, which contain both BitTorrent v1 and v2 keys. Unfortunately libtransmission, as of yet, is unable to parse hybrid torrents. The reason for that is that empty strings are handled specially, and - as far as I can see - used to indicate invalid strings / errors. BitTorrent v2 heavily utilizes empty strings as directory keys, and that prevents libtransmission from parsing hybrid torrents.

One problematic line is variant-benc.c:161, which causes parsing to fail if the quark id is zero, which happens when an empty string is encountered.

A solution I see is a new value for TR_KEY_NONE, that is not the empty string. It could be NULL, however, then I think quark.c:compareKey() should be prepared to handle NULL. I don't know how much of the code base relies on TR_KEY_NONE being and empty string, so this is just speculation.

I would appreciate if a fix could be implemented, since, hopefully, more and more BitTorrent clients will start to move away from BitTorrent v1 to BitTorrent v2.

Most helpful comment

I'd say at least add support for hybrid torrents, even if BT2 support isn't planned.

All 2 comments

This creates a chicken-and-egg problem for adopting v2.

Clients don't support v2 because publishers aren't creating v2 torrents; publishers aren't creating v2 torrents because they break existing clients...

I'd say at least add support for hybrid torrents, even if BT2 support isn't planned.

Was this page helpful?
0 / 5 - 0 ratings