mafintosh / mafintosh/websock

Another slice issue in buffer.js

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

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
8
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
buffer.js:375
if (start > end) throw new Error('oob');
^
Error: oob
at Buffer.slice (buffer.js:375:26)
at [object Object].empty (.../node_modules/websock/buffers.js:74:13)
at .../node_modules/websock/protocol-8.js:128:22
at Socket. (.../node_modules/websock/protocol-8.js:170:28)
at Socket.emit (events.js:64:17)
at Socket._onReadable (net.js:672:14)
at IOWatcher.onReadable [as callback] (net.js:177:10)
```

Seems like length must not be < 1, but you only check (!length)?

Contributor guide

No contributing guide indexed for this repository

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 at buffer.js:375, then inspect buffers.js:74 and protocol-8.js:128 to trace the length passed to Buffer.slice. Reproduce the reported empty-buffer path and compare the handling of zero and negative lengths with the issue's expected bounds; done means the failing path is resolved and covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.