Skip to content

Fix fread crashes#5046

Merged
mattdowle merged 5 commits intomasterfrom
fix_fread_crash_unbalanced_quotes
Jun 21, 2021
Merged

Fix fread crashes#5046
mattdowle merged 5 commits intomasterfrom
fix_fread_crash_unbalanced_quotes

Conversation

@tlapak
Copy link
Copy Markdown
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
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