decode.bytes does not adhere to abstract-encoding spec

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

Nobody has claimed this yet.

Assessment

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

Research direction

Start at the decode.bytes entry point and compare its behavior with the abstract-encoding specification. Reproduce decoding input containing additional data, then add or update coverage so the result reports only the bytes consumed rather than the full input length.

Written by the indexing model from the issue text.

Description

What version of this package are you using?
Latest

What operating system, Node.js, and npm version?
Arch Linux, latest Node LTS (v20)

What happened?
decode.bytes returns the length of the entire input data after decoding

What did you expect to happen?
It should've returned only the number of bytes consumed.

Are you willing to submit a pull request to fix this bug?
Yes

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

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.

More from webtorrent/node-bencode

All issues in webtorrent/node-bencode

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.