Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fread crashes #5046

Merged
merged 5 commits into from
Jun 21, 2021
Merged

Fix fread crashes #5046

merged 5 commits into from
Jun 21, 2021

Conversation

tlapak
Copy link
Contributor

@tlapak tlapak commented Jun 16, 2021

Closes #5041
closes #4774

Unbalanced quotes out of sample in a character column would be registered as a type bump but character is already the highest type. The segfault occurred in the next attempt to select the corresponding reader on what is currently line 2272 of fread.c

While testing my fix I stumbled upon another segfault that I also fixed here by stealing the fix for #4644, which happened for essentially the same reasons. The following would segfault before:

fread(paste0(paste(rep(c('1; 2'), 100), collapse = '\n'), c('\n"a";2\n1; 2\n'), paste(rep(c('1; 2'), 100), collapse = '\n')),
fill = TRUE, verbose = TRUE, header = FALSE)

Toggling any of the options prevents the segfault. Again the type bump must occur out of sample. I was slightly stumped by varying sampling behaviour of fread.

@mattdowle mattdowle added this to the 1.14.1 milestone Jun 21, 2021
@mattdowle mattdowle merged commit bf442ed into master Jun 21, 2021
@mattdowle mattdowle deleted the fix_fread_crash_unbalanced_quotes branch June 21, 2021 21:37
@jangorecki jangorecki modified the milestones: 1.14.9, 1.15.0 Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fread crashes R Segfault on call to fread with fill = TRUE
3 participants