fix: tolerate malformed UTF-16 row values - #426
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. Summary by CodeRabbit
WalkthroughNCHAR, NVARCHAR, and NTEXT now replace malformed UTF-16 sequences with Merge Risk: ⚪ Minimal · up to The change replaces malformed Unicode surrogate values while preserving protocol-length validation, and no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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 |
Summary
NCHAR,NVARCHAR, andNTEXTrow values lossily so unpaired UTF-16 surrogates becomeU+FFFDinstead of terminating the query streamNTEXTguardRationale
ColumnData::Stringstores a RustString, which cannot represent unpaired UTF-16 surrogate code units. The current strict conversion returnsError::Utf16while decoding the row, before callers can inspect or skip the affected value. Replacing only malformed surrogate sequences keeps the result stream readable without relaxing TDS framing validation.Fixes #325
Testing
cargo fmt --all -- --checkcargo clippy --lib --features tds73 -- -D warningscargo clippy --features=allcargo test --lib --features tds73(125 passed)cargo test --lib --features=all(128 passed)cargo test --lib --no-default-features(106 passed)