Last 12 weeks · 1 commit
3 of 6 standards met
This pull request fixes an issue in the CSV parser where comment lines at the end of a file were not properly ignored. According to expected behavior, if the last line(s) of a CSV file are comments (e.g., start with #), they should not be treated as data records, even if they appear at the end of the file without a trailing newline. Fix: #363 This is my first contribution to this project. If there are any issues with my implementation, code style, or the contribution process, please let me know. I am happy to make any necessary changes and appreciate your guidance. Thank you for your time and consideration!
Summary consume the LF portion of a CRLF terminator before returning a completed record preserve the record boundary when CRLF is split across input buffers keep reader and record line positions aligned with the next record Testing AI assistance disclosure: I used OpenAI Codex to help analyze the parser state machine, implement the change, and run and review the tests. I reviewed the complete diff and validation results. Fixes #395
When is disabled, the writer escapes quote characters with the escape character (default ), but it did not escape occurrences of the escape character itself in field data. Because the reader treats the escape character inside a quoted field as escaping the following byte, any escape character in the data was silently consumed on read-back. Repro (current ): A lone field is worse: it swallows the closing quote and the following delimiter, mangling the whole record. The writer already force-quotes fields containing the escape byte (), so the fix is to also double the escape byte inside when is false, making the escaping self-consistent and the round-trip lossless. The default () path is unchanged. Adds regression tests at the and levels.
scan ordinary DFA field bytes in runs instead of dispatching every byte build readers from configuration without cloning DFA storage preserve complete DFA state when cloning readers count newlines correctly with custom terminators and comments trim byte and string records in place without temporary records skip redundant ASCII trimming when reading string records clone only active header fields and bounds reserve field-bound storage from iterator lower bounds remove hot forward-iteration and active-slice bounds checks format StringRecord debug output without collecting fields validate byte-record UTF-8 once during deserialize_any inference fast-path successful char and empty-option deserialization use debug-only checking for the internal map-header invariant classify integer fields before attempting floating-point parsing inline reusable record reads to eliminate trim-flag overhead add Gungraun coverage for every existing benchmark and focused hot paths Representative benchmark results: Instruction counts are Callgrind results. Wall times are medians across three runs, each using the median of 21 batched samples.
This PR is to add fuzzing support, and I want to integrate into OSS-Fuzz. This is a free service by Google where they perform continuous fuzzing of open-source projects used by industry and with the only expectation that maintainers of the project will patch the bugs found by OSS-Fuzz. If you are interested in this, could you please provide me with an email address that will be receiving the bug reports that OSS-Fuzz find?
Repository: BurntSushi/rust-csv. Description: A CSV parser for Rust, with Serde support. Stars: 1959, Forks: 256. Primary language: Rust. Languages: Rust (99.5%), Shell (0.3%), Python (0.2%). License: Unlicense. Topics: csv, library, rust, rust-library. Open PRs: 37, open issues: 65. Last activity: 1mo ago. Community health: 42%. Top contributors: BurntSushi, paolobarbolini, brandonw, EvinRobertson, fhartwig, huonw, igor-raits, jturner314, thaliaarchi, timhabermaas and others.