casey / intermodal

A command-line utility for BitTorrent torrent file creation, verification, and more
https://imdl.io
Creative Commons Zero v1.0 Universal
487 stars 25 forks source link

Failed to deserialize torrent metainfo #454

Open mueslo opened 4 years ago

mueslo commented 4 years ago
$ imdl torrent show tmp/somefile.torrent
error: Failed to deserialize torrent metainfo from `tmp/somefile.torrent`: Error: bencode encoding corrupted (Keys were not sorted)

Created by uTorrent/2210

File cannot be provided, but works fine in normal torrent clients.

imdl version 0.1.8

casey commented 4 years ago

That's interesting!

BitTorrent metainfo is stored in a format called bencode, which requires that keys in dictionaries be stored in sorted order. Intermodal rejects .torrent files where the keys aren't in order.

It sounds like other torrent clients don't actually do this, which is surprising.

I'd like to get my hands on the torrent file, just to make sure that the keys are actually out of order, but I understand if the contents are sensitive. I might be able to write a tool that dumps the keys in a torrent file, which would help diagnose the problem without exposing any information about the contents.

Is this the only torrent file that you've had issues with, and did you create it yourself?

awsms commented 3 years ago

same here with torrents from oppaitime.

casey commented 3 years ago

@awsms Is it the same bencode encoding corrupted (Keys were not sorted) error? Torrents with unsorted keys are technically invalid, so I'm unsure what should be done.