about summary refs log tree commit diff
path: root/custom_mutators/gramatron/gramfuzz.c
diff options
context:
space:
mode:
Diffstat (limited to 'custom_mutators/gramatron/gramfuzz.c')
-rw-r--r--custom_mutators/gramatron/gramfuzz.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/custom_mutators/gramatron/gramfuzz.c b/custom_mutators/gramatron/gramfuzz.c
index fd126ec0..d64d2fa9 100644
--- a/custom_mutators/gramatron/gramfuzz.c
+++ b/custom_mutators/gramatron/gramfuzz.c
@@ -125,7 +125,6 @@ state *create_pda(u8 *automaton_file) {
 
 my_mutator_t *afl_custom_init(afl_state_t *afl, unsigned int seed) {
 
-  srand(seed);
   my_mutator_t *data = calloc(1, sizeof(my_mutator_t));
   if (!data) {
 
@@ -142,6 +141,7 @@ my_mutator_t *afl_custom_init(afl_state_t *afl, unsigned int seed) {
   }
 
   data->afl = afl;
+  global_afl = afl;  // dirty
   data->seed = seed;
 
   data->mut_alloced = 0;
@@ -211,7 +211,7 @@ size_t afl_custom_fuzz(my_mutator_t *data, uint8_t *buf, size_t buf_size,
   } else if (data->mut_idx == 2) {  // Perform splice mutation
 
     // we cannot use the supplied splice data so choose a new random file
-    u32                 tid = rand() % data->afl->queued_paths;
+    u32                 tid = rand_below(global_afl, data->afl->queued_paths);
     struct queue_entry *q = data->afl->queue_buf[tid];
 
     // Read the input representation for the splice candidate