Repository navigation
fix: reject stream peeks beyond known EOF before allocating lookahead - #1345
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
EOF preflight and validation lib/ReadStreamTokenizer.ts, README.md, test/test-truncation.ts |
peekBuffer checks the known size before lookahead allocation or source I/O. The README documents the behavior, and tests cover both mayBeLess settings, view depths, unchanged buffers and positions, and subsequent reads. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- Borewit/strtok3#1344: Adds a similar known-size EOF preflight check to
ignore(), while this PR applies it topeekBuffer().
Merge Risk: 
Minimal · up to d9e92
-
The known-size EOF behavior appears aligned across the change and its tests; no merge-blocking issue is identified.
Pre-merge checks: 
4
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Codecov Report✅ All modified and coverable lines are covered by tests. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Resolves the issue where a nonempty stream peek at or beyond the known input size allocates lookahead from an untrusted offset before discovering EOF.
Return zero for
mayBeLesspeeks or reject withEndOfStreamErrorbefore allocation or source I/O, including through tokenizer views. Preserve zero-length peeks and partial EOF behavior for requests starting inside the advertised input.Summary by CodeRabbit