Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: invalid literal for int() with base 10: b'i1e' in TorrentDef.is_private() #7213

Closed
kozlovsky opened this issue Dec 7, 2022 · 1 comment · Fixed by #7214
Closed

Comments

@kozlovsky
Copy link
Collaborator

Sometimes TorrentDef.is_private() method crashes with the following error:

ValueError: invalid literal for int() with base 10: b'i1e' 

The private field of the info dict in the torrent metadata description should be of int type. Sometimes it has a bytes value b'i1e'. That value corresponds to the bencoded int value 1. It seems that some torrents files have their metadata incorrectly encoded, with the private field encoded twice: first, it is bencoded 1 -> b'i1e', and then it is bencoded again during the usual process of encoding the entire meta info dict.

To avoid the crash, an additional check should be added to the code that reads the attribute value.

The value b'i1e' means that the intention of the torrent's author was to set private=1 for the torrent. But as the value is technically incorrect, we can fall back to the default property value private=0 when interpreting this incorrect value.

@sentry-for-tribler
Copy link

Sentry issue: TRIBLER-112

kozlovsky added a commit to kozlovsky/tribler that referenced this issue Dec 7, 2022
kozlovsky added a commit to kozlovsky/tribler that referenced this issue Dec 7, 2022
kozlovsky added a commit to kozlovsky/tribler that referenced this issue Dec 7, 2022
kozlovsky added a commit to kozlovsky/tribler that referenced this issue Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant