webtorrent / webtorrent/node-bencode

Integers should have no size limitation.

Open
#143 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
173
Forks
38
PR merge metrics
No merged PRs in 30d

Description

Bug: it fails to satisfy the specification.

BEP 52 — The BitTorrent protocol specification version 2

Integers have no size limitation.

Currently, node-bencode allows decoded integer data to be corrupted. It should either use bigints or throw on a long integer input.

https://github.com/webtorrent/node-bencode/blob/2fa2c7ea7d97791a0c7f0cb3dd0bb098c014738f/lib/decode.js#L18-L28

yourdecode("i9007199254740991e") === yourdecode("i9007199254740992e")

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/decode.js at lines 18-28 and reproduce the example showing that two large integer inputs decode identically. Check the existing decoder behavior and determine how the implementation will honor the specification, either by preserving large integers or rejecting them. Done means large integer inputs are no longer silently corrupted.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.