8000 fix: snapshot self-referential append and prepend inputs by fbirds5230 · Pull Request #194 · rvagg/bl · GitHub
[go: up one dir, main page]

Skip to content

fix: snapshot self-referential append and prepend inputs - #194

Merged
rvagg merged 1 commit into
rvagg:masterfrom
fbirds5230:fix/snapshot-self-attachment
Nov 25, 2026
Merged

rvagg merged 1 commit into
rvagg:masterfrom
fbirds5230:fix/snapshot-self-attachment

Conversation

@fbirds5230
@fbirds5230 fbirds5230 commented Nov 23, 2026 •
Copy link
Copy Markdown
Contributor

Passing a list, or its getBuffers() result, back to append() or prepend() makes _attach() iterate the same array it is changing. Self-prepend scrambles the data (abc becomes aacabc), while self-append keeps visiting newly appended entries and never finishes.

Snapshot the buffer entries when the input aliases the destination. This preserves byte order and lets both operations finish without copying the underlying buffer data.

The tests cover BufferList and BufferListStream, both input forms, empty buffers and lists, partially and fully consumed lists, chainability, and shared buffer memory. A buffer-count guard makes a self-append regression fail promptly instead of growing indefinitely. The regression checks reproduce both failures on the unchanged base.

Validation on Node 24.22.3:

  • npm run build
  • npm run test:ci: lint, 1,219 runtime assertions, declaration build, TypeScript checks and 55 API/type parity assertions pass.
  • Regenerated the declaration source map required by the build check.

@rvagg
rvagg merged commit 1ee55ab into rvagg:master Nov 25, 2026
7 checks passed
github-actions Bot pushed a commit that referenced this pull request Nov 25, 2026
## [7.0.19](v7.0.18...v7.0.19) (2026-11-25)

### Bug Fixes

* snapshot self-referential append and prepend inputs ([#194](#194)) ([1ee55ab](1ee55ab))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 7.0.19 🎉

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