Skip to content

Commit

Permalink
Merge pull request #93 from sebhtml/mmap-failure
Browse files Browse the repository at this point in the history
mash: abort if mmap fails to map the file
  • Loading branch information
ondovb committed Jul 30, 2018
2 parents aa809ba + cd180b2 commit 6752843
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mash/Sketch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,14 @@ uint64_t Sketch::initParametersFromCapnp(const char * file)

void * data = mmap(NULL, fileInfo.st_size, PROT_READ, MAP_PRIVATE, fd, 0);

if (data == MAP_FAILED)
{
uint64_t fileSize = fileInfo.st_size;
std::cerr << "Error: could not memory-map file " << file << " of size " << fileSize;
std::cerr << std::endl;
exit(1);
}

capnp::ReaderOptions readerOptions;

readerOptions.traversalLimitInWords = 1000000000000;
Expand Down

0 comments on commit 6752843

Please sign in to comment.