8000 fix: return empty results for reversed buffer ranges by omrzk · Pull Request #191 · rvagg/bl · GitHub
[go: up one dir, main page]

Skip to content

fix: return empty results for reversed buffer ranges - #191

Merged
rvagg merged 1 commit into
rvagg:masterfrom
omrzk:fix/reversed-buffer-ranges
Nov 21, 2026
Merged

rvagg merged 1 commit into
rvagg:masterfrom
omrzk:fix/reversed-buffer-ranges

Conversation

@omrzk
@omrzk omrzk commented Nov 20, 2026
Copy link
Copy Markdown
Contributor

Reading a reversed range depends on the internal chunk layout: for example, new BufferList(['abcd', 'efgh']).slice(5, 2) returns f, while shallowSlice(5, 2) throws. A native Buffer returns an empty slice for that range. Copying a reversed range can also modify the destination or throw when the range starts inside a later chunk.

Return an empty result, or leave the copy destination unchanged, after normalizing a range whose end does not follow its start. The regression covers both exported classes, single and multiple chunks, negative slice offsets, and ordinary/equal-range controls.

Validation: npm run test:ci passed on Node 20.20.2, 22.23.2, and 26.13.0 (lint, 983 runtime assertions, declaration build, TypeScript consumer checks, and 55 generated API assertions). The added regression produces 32 failed assertions on the unchanged upstream source. A separate public API matrix, including a piped stream consumer and shallow-memory sharing control, passed 2,927 checks per runtime; upstream failed 326 of those checks on Node 22.

@rvagg
rvagg merged commit 33296e7 into rvagg:master Nov 21, 2026
7 checks passed
github-actions Bot pushed a commit that referenced this pull request Nov 21, 2026
## [7.0.16](v7.0.15...v7.0.16) (2026-11-21)

### Bug Fixes

* handle reversed buffer ranges consistently ([#191](#191)) ([33296e7](33296e7))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 7.0.16 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0