bencode.decode(data) fails with data from some .torrent files like:
test2.zip
Traceback (most recent call last):
File "H:\Programmation\Deluge\test_decode.py", line 18, in
dic = bencode.decode(data)
File "python-bittorrent/bencode.py", line 286, in decode
return decode_functionsben_type(data)
File "python-bittorrent/bencode.py", line 252, in decode_dict
terms = inflate(data)
File "python-bittorrent/bencode.py", line 85, in inflate
xs = inflate(exp[strlength:])
File "python-bittorrent/bencode.py", line 85, in inflate
xs = inflate(exp[strlength:])
File "python-bittorrent/bencode.py", line 85, in inflate
xs = inflate(exp[strlength:])
File "python-bittorrent/bencode.py", line 85, in inflate
xs = inflate(exp[strlength:])
File "python-bittorrent/bencode.py", line 85, in inflate
xs = inflate(exp[strlength:])
File "python-bittorrent/bencode.py", line 85, in inflate
xs = inflate(exp[strlength:])
File "python-bittorrent/bencode.py", line 85, in inflate
xs = inflate(exp[strlength:])
File "python-bittorrent/bencode.py", line 77, in inflate
xs = inflate(exp[end + 1:])
File "python-bittorrent/bencode.py", line 85, in inflate
xs = inflate(exp[strlength:])
File "python-bittorrent/bencode.py", line 91, in inflate
end = walk(exp) # Find the end of the data type
File "python-bittorrent/bencode.py", line 49, in walk
return walk(exp, index + strlength)
File "python-bittorrent/bencode.py", line 55, in walk
return walk(exp, index + endsub)
File "python-bittorrent/bencode.py", line 49, in walk
return walk(exp, index + strlength)
File "python-bittorrent/bencode.py", line 49, in walk
return walk(exp, index + strlength)
File "python-bittorrent/bencode.py", line 49, in walk
return walk(exp, index + strlength)
File "python-bittorrent/bencode.py", line 43, in walk
return walk(exp, endchar + 1)
File "python-bittorrent/bencode.py", line 49, in walk
return walk(exp, index + strlength)
File "python-bittorrent/bencode.py", line 49, in walk
return walk(exp, index + strlength)
File "python-bittorrent/bencode.py", line 40, in walk
if exp[index] == "i":
IndexError: string index out of range