BEncode::DecodeError: invalid string length
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ruby bencode implementation |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
EDIT: I think it may have something to do with the way the file's encoded?
I added "puts str.length" before the begin statement, and the number is wildly different from what is expected.
length = 27880
str.length = 2000
When I load up the file (File.open(
Also, when I use ruby to rewrite the file, it gets much much smaller. 2kb down from 28kb.
--
Every torrent file I've tried to read gives me the same error, "BEncode:
I've tried the torrents in several torrent clients, but they all work.
After editing bdecode.rb and adding two lines to BEncode::parse
begin
rescue RangeError
puts "scanner.pos = " + scanner.pos.to_s
puts "length = " + length.to_s
raise BEncode:
end
I get the following output:
irb(main):001:0> require 'bdecode.rb'
=> true
irb(main):002:0> BEncode:
scanner.pos = 223
length = 27880
BEncode:
from ./bdecode.rb:62:in `parse'
from ./bdecode.rb:43:in `parse'
from ./bdecode.rb:15:in `load'
from ./bdecode.rb:22:in `load_file'
from (irb):2
irb(main):003:0> File.open(
=> 28105
here's the download link to the torrent file (It's also attatched):
http://
ruby -v:
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
gem -v:
1.1.0
BEncode gem version: 0.5.0
I think the string may be UTF-8... I'll have to add support for that, then.