Fix binascii.b2a_qp CRLF boundary check#8358
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesQuoted-printable encoding
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Assisted-by: Codex:gpt-5.6-sol
5c7950f to
d73df27
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/stdlib/src/binascii.rs`:
- Line 507: Preserve the in_idx > 0 guard in the CRLF handling condition to
prevent out-of-bounds indexing, then run cargo fmt --all -- --check with
cargo-fmt available and run Clippy, resolving any warnings before merge.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0470bf12-b8f8-45fd-a845-740ac811da17
📒 Files selected for processing (1)
crates/stdlib/src/binascii.rs
Summary
binascii.b2a_qp()from panicking when the input starts with\n.When the first byte is
\n,in_idxremains zero and accessingbuf[in_idx - 1]causes an integer underflow.This change checks
in_idx > 0before accessing the preceding byte.Testing
cargo run -- -c 'import binascii; assert binascii.b2a_qp(b"\n") == b"\n"'cargo run --release -- -m test test_binasciiBefore this change, the RustPython command panicked with:
AI assistance
Codex (GPT‑5.6 Sol) was used to investigate and implement this change.
I reviewed and validated all AI-assisted work.
Summary by CodeRabbit