Skip to content

Commit d947244

Browse files
committed
Add test for fread segfault with \x1a bytes
Reproduces issue #7407 where fread crashes when reading files with \x1a (ASCII SUB) character. Manual testing confirms both test cases trigger segmentation fault as expected.
1 parent 171e272 commit d947244

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

inst/tests/tests.Rraw

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21858,3 +21858,14 @@ test(2344.04, key(DT[, .(V4 = c("b", "a"), V2, V5 = c("y", "x"), V1)]), c("V1",
2185821858

2185921859
# fread with quotes and single column #7366
2186021860
test(2345, fread('"this_that"\n"2025-01-01 00:00:01"'), data.table(this_that = as.POSIXct("2025-01-01 00:00:01", tz="UTC")))
21861+
21862+
# Test cases that reproduce the segfault when fread encounters \\x1a (ASCII SUB) character at or near end of field #7407
21863+
test(9063.1, {
21864+
fread(text=paste0("foo\n", strrep("a", 4096*100), "\x1a"))
21865+
TRUE
21866+
}, TRUE)
21867+
21868+
test(9063.2, {
21869+
fread(text="a,b\n1,2\n3,4\x1a")
21870+
TRUE
21871+
}, TRUE)

0 commit comments

Comments
 (0)