Skip to content

fread fails when max_nrows argument is too small #2243

@st-pasha

Description

@st-pasha

Example:

> fread("~/github/h2oai-benchmarks/Data/Homesite/train.csv", nrows=10)

 *** caught segfault ***
address 0x2596, cause 'memory not mapped'
R(60974,0x700000804000) malloc: *** error for object 0x7f97e8d9c0b8: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

Reason: around line 1794 we compute size_t initialBuffRows = allocnrow / (size_t)nJumps;. Here allocnrow is small (set by the user), while nJumps is large (determined by the file size). As a result, 0 rows are allocated for the buffers, and subsequently any attempt to write into them causes a segfault.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions