Repository navigation
Conversation
`long` is 32-bit on Windows (LLP64), so `readstat_set_row_limit()` and `readstat_set_row_offset()` overflow for files with more than ~2.15 billion rows there. Widen the parser fields and setter arguments to `int64_t`, along with the internal `row_limit`/`row_offset` context fields in the sas7bdat, xport, sav, and por readers (previously `uint32_t`/`int`) so the full range is preserved end-to-end. The Stata reader already used `int64_t`.
Contributor
Author
|
🤖 Written by AI 🤖 One deliberate scope boundary: the per-row counters that are compared against |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Written by AI 🤖
readstat_set_row_limit()andreadstat_set_row_offset()takelong, which is 64-bit on Unix but 32-bit on Windows (LLP64). On Windows, this caps row offsets at ~2.15 billion, which blocks chunked reading of very large files (see tidyverse/haven#194 for a real-world report).This PR widens the row limit/offset to
int64_tthroughout:readstat_parser_tfields and the two setter signatures inreadstat.h/readstat_parser.cuint32_t), xport (int), sav (int), and por (int) readers, so the full range survives the handoff from parser to readerrow_limit(int kcould overflow for limits aboveINT_MAX)snprintfformat updated toPRId64accordinglyThe Stata reader already used
int64_tfor these fields, so this also makes the readers consistent.Note this changes the public API signatures of the two setters. On Windows, callers passing
longwill still compile (implicit widening), but the ABI changes.make checkpasses (4/4, including thetest_readstatcorpus suite).