bencode-go icon indicating copy to clipboard operation
bencode-go copied to clipboard

panic: setint called for bogus type: string

Open senioi opened this issue 6 years ago • 3 comments

sample.zip

senioi avatar Aug 26 '18 19:08 senioi

Thank you for reporting this issue!

Unfortunately I don't have a Windows machine to run the sample executable that you have provided. (And if I did, I would be worried about a possible virus.) Could you paste the panic stack trace, or provide a source code version of the sample?

jackpal avatar Aug 27 '18 04:08 jackpal

I read through the source code for bencode-go/struct.go, and it looks like this panic can happen when trying to deserialize a bencode integer into a go struct that has a string field.

I don't think this is an error in the bencode library. Instead, I think it is due to a mis-match between the format of the encoded data and the struct you are trying to deserialize into.

A work-around would be to use the Decode API to return generic Go data structures, and then pick through the generic Go data on your own.

jackpal avatar Aug 27 '18 04:08 jackpal

@jackpal Thanks for your reply. This sample.zip just a torrent file, It is not an executable file. sample_2.zip

senioi avatar Aug 27 '18 04:08 senioi