Files
stutterfuzz/stutterfuzz.c

24 lines
595 B
C
Raw Normal View History

2016-03-03 23:02:19 -08:00
#include <stdio.h>
#include <stdint.h>
#include "rand.h"
2016-03-04 10:17:10 -08:00
static uint64_t get_split(uint64_t total_len, uint64_t remaining_len) {
2016-03-03 23:02:19 -08:00
uint64_t rnd;
rand_fill(&rnd, sizeof(rnd));
2016-03-04 10:17:10 -08:00
rnd %= total_len;
return rnd > remaining_len ? remaining_len : rnd;
2016-03-03 23:02:19 -08:00
}
int main(int __attribute__ ((unused)) argc, char __attribute__ ((unused)) *argv[]) {
rand_init();
2016-03-04 10:17:10 -08:00
uint64_t total_len = 1397;
for (uint64_t remaining = total_len, consume = 0; remaining; remaining -= consume) {
consume = get_split(total_len, remaining);
2016-03-03 23:02:19 -08:00
fprintf(stderr, "consume %ju bytes\n", (uintmax_t) consume);
}
rand_cleanup();
}