Repository navigation
Conversation
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.
dta_add_missing_double and dta_add_missing_date in the CSV to .dta path store each missing value as a range at missing_ranges[2idx] and [2idx+1], but the only limit is the Stata tag check ('a' + idx <= 'z', 26 values) while readstat_missingness_t has room for 16 ranges. A metadata.json column with 17 or more entries in missing.values (or 17 category codes inside missing.low/high) overwrites missing_ranges_count and the rest of the variable, after which the count holds the stored value's bits and the next index comes from the JSON. With 18 DATE missing values (1960-01-01 to 1960-01-16, then 1960-01-20 and 1960-01-21),
readstat input.csv metadata.json output.dtahits an ASan heap-buffer-overflow WRITE at mod_dta.c:54.Exit with an error once the array is full, next to the existing tag-limit check in both helpers. mod_sav goes through readstat_variable_add_missing_double_range, which already bounds the array, so only the dta module needs it.