uint64_t valcount;
int ret;
+ if (len < BUFLEN) {
+ fprintf(stderr, "Error: File size needs to be at least %u\n", BUFLEN);
+ exit(EXIT_FAILURE);
+ }
+
memset(buf, 0, BUFLEN);
for (;;) {
if (len > UINT32_MAX) {
- offset = (((size_t) rand() << 32) + (size_t) rand()) % len;
+ offset = (((size_t) rand() << 32) + (size_t) rand()) % (len - BUFLEN);
} else {
- offset = rand() % len;
+ offset = rand() % (len - BUFLEN);
}
if ((offset >= validate_offset &&