fix: correct inverted bounds check in readBuffered methods by gnodet · Pull Request #1853 · jline/jline3 (original) (raw)

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info ⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a8f2091f-a832-4114-a3ea-5c3365d26d99

📥 Commits

Reviewing files that changed from the base of the PR and between 9934d8f and 2505e5a.

📒 Files selected for processing (2)


📝 Walkthrough

Walkthrough

Two methods have their buffer bounds validation logic refactored, changing from off + len < b.length to len > b.length - off for clearer and more reliable parameter range checking during read operations.

Changes

Cohort / File(s) Summary
Buffer Bounds Validation terminal/src/main/java/org/jline/utils/NonBlockingInputStream.java, terminal/src/main/java/org/jline/utils/NonBlockingPumpReader.java Updated readBuffered() parameter validation to use safer bounds check: reformulated condition from off + len < b.length to len > b.length - off for improved clarity in detecting invalid buffer offset/length combinations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hops through bounds with care so fine,
Off and len now align,
Math was clear, but clearer still,
Safety checks with rabbit's will!
Two methods improved, the buffers stay safe,
No overflow shall grace this place! 🥕✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.

✅ Passed checks (4 passed)

Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: correct inverted bounds check in readBuffered methods' accurately describes the main change: fixing an inverted bounds check condition in the readBuffered methods by replacing 'off + len < b.length' with 'len > b.length - off'.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches 📝 Generate docstrings


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.