Skip to content

Commit

Permalink
Adding "Offset is past end of file" checks
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Mar 23, 2022
1 parent 463770a commit 061c875
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cpp/src/io/utilities/datasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class direct_read_source : public file_source {

std::unique_ptr<buffer> host_read(size_t offset, size_t size) override
{
CUDF_EXPECTS(offset < _file.nbytes(), "Offset is past end of file");
lseek(_file.fd(), offset, SEEK_SET);

// Clamp length to available data
Expand All @@ -168,6 +169,7 @@ class direct_read_source : public file_source {

size_t host_read(size_t offset, size_t size, uint8_t* dst) override
{
CUDF_EXPECTS(offset < _file.nbytes(), "Offset is past end of file");
lseek(_file.fd(), offset, SEEK_SET);

// Clamp length to available data
Expand Down

0 comments on commit 061c875

Please sign in to comment.