csv-parser v5.8.0
Permanent link:
cppdashboard.dev/r/2026/11/csv-parser-v5-8-0A modern C++ CSV parser and serializer that doesn't make you choose between ease of use or performance.
Release notes
# csv-parser v5.8.0
v5.8.0 replaces `eof()` with an unambiguous way to check for another row, fixes parser-worker races, makes empty-file behavior consistent, and adds continuous differential fuzzing.
These notes cover all changes since v5.7.1.
## How this release came together
I ran three GPT-5.6 Sol agents at Ultra effort to independently:
- Audit the parser for memory errors.
- Look for thread races.
- Design and implement fuzzing for CI.
The memory audit found no confirmed memory-safety defects.
The thread-race investigation, run with Daybreak enabled, found and reproduced a potential race in `CSVReader::eof()`. A caller could query `eof()` at the same time the background parser was finishing the final source chunk and setting its internal EOF flag. The same investigation found that speculative-parsing diagnostics could be read while the worker was updating their counters.
The narrow fix for `eof()` would have been to make its internal flag atomic. That led me to question the point of the method itself. `eof()` answered whether the parser had reached the end of its input, but the question users were more likely to be asking was whether the CSV still had another row to read. Those are not always the same thing because parsed rows may remain queued after the source is exhausted.
It was better to remove the ambiguous API and replace it with one that directly answers the useful question.
The fuzzing work also paid off immediately. Differential replay found that a readable zero-byte file produced ordinary exhaustion through the stream backend but `OpenFailed` through the memory-mapped backend. That inconsistency is fixed in this release.
## `eof()` replaced by row lookahead
C++ `CSVReader::eof()` and Python `Reader.eof()` have been removed.
Normal consuming loops should use `read_row()` or iteration:
```cpp
while (reader.read_row(row)) {
// Process row.
}
```
When a non-consuming check is actually needed, use `has_next_row()`:
```cpp
if (reader.has_next_row()) {
// Another logical row can be read.
}
```
Exception-disabled and explicit-error code can use `try_has_next_row()`:
```cpp
csv::CSVError error;
if (reader.try_has_next_row(error)) {
// A row is available.
} else if (error) {
// Parsing failed.
} else {
// Ordinary exhaustion.
}
```
Repeated lookahead calls do not consume the next returnable row. The check may block while parsing finishes and may skip physical records excluded by the configured variable-column policy.
The regular `read_row()` path remains unchanged. Only callers requesting lookahead pay for the synchronized queue-front copy.
`CSVReader` remains a single-consumer object. Lookahead is not intended to make concurrent user operations safe.
## Thread-race fixes
The public EOF race is eliminated by keeping source exhaustion as a worker-owned internal detail.
`speculative_diagnostics()` now synchronizes updates and snapshots so callers cannot observe counters halfway through a merge.
Large regression tests exercise both the memory-mapped and stream paths while their background workers cross multiple parser windows.
See [#353](https://github.com/vincentlaucsb/csv-parser/issues/353) for the original reports and ThreadSanitizer reproductions.
## Empty files
Readable zero-byte files now behave consistently across parser backends: opening succeeds, and attempts to read a row report ordinary exhaustion.
Previously, native mapping APIs caused the memory-mapped path to report `OpenFailed`, even though the file existed and was readable. The differential fuzzer discovered this discrepancy.
Missing and unreadable files continue to report errors normally.
## Continuous fuzzing
The repository now includes opt-in Clang/libFuzzer targets covering:
- Arbitrary stream parsing.
- Differential behavior between stream and memory-mapped parsing.
- Synchronous and threaded scheduling.
- Quotes… Share this resource