afl-fuzz.c
static u32 choose_block_len(u32 limit) {

  u32 min_value, max_value;
  u32 rlim = MIN(queue_cycle, 3);

  if (!run_over10m) rlim = 1;

  switch (UR(rlim)) {

    case 0:  min_value = 1;
             max_value = HAVOC_BLK_SMALL;
             break;

    case 1:  min_value = HAVOC_BLK_SMALL;
             max_value = HAVOC_BLK_MEDIUM;
             break;

    default:

             if (UR(10)) {

               min_value = HAVOC_BLK_MEDIUM;
               max_value = HAVOC_BLK_LARGE;

             } else {

               min_value = HAVOC_BLK_LARGE;
               max_value = HAVOC_BLK_XL;

             }

  }

  if (min_value >= limit) min_value = 1;

  return min_value + UR(MIN(max_value, limit) - min_value + 1);

}
/* Helper to choose random block len for block operations in fuzz_one().
   Doesn't return zero, provided that max_len is > 0. */
Helper to choose random block len for block operations in fuzz_one().
Doesn't return zero, provided that max_len is > 0.
Helper to choose random block len for block operations in fuzz_one () . Doesn ' t return zero provided that max_len is > 0 .
static u32 choose_block_len(u32 limit) {
  u32 min_value, max_value;
  u32 rlim = MIN(queue_cycle, 3);
  if (!run_over10m) rlim = 1;
  switch (UR(rlim)) {
    case 0:  min_value = 1;
             max_value = HAVOC_BLK_SMALL;
             break;
    case 1:  min_value = HAVOC_BLK_SMALL;
             max_value = HAVOC_BLK_MEDIUM;
             break;
    default:
             if (UR(10)) {
               min_value = HAVOC_BLK_MEDIUM;
               max_value = HAVOC_BLK_LARGE;
             } else {
               min_value = HAVOC_BLK_LARGE;
               max_value = HAVOC_BLK_XL;
             }
  }
  if (min_value >= limit) min_value = 1;
  return min_value + UR(MIN(max_value, limit) - min_value + 1);
}
static u32 choose_block_len ( u32 limit ) { u32 min_value , max_value ; u32 rlim = MIN ( queue_cycle , 3 ) ; if ( ! run_over10m ) rlim = 1 ; switch ( UR ( rlim ) ) { case 0 : min_value = 1 ; max_value = HAVOC_BLK_SMALL ; break ; case 1 : min_value = HAVOC_BLK_SMALL ; max_value = HAVOC_BLK_MEDIUM ; break ; default : if ( UR ( 10 ) ) { min_value = HAVOC_BLK_MEDIUM ; max_value = HAVOC_BLK_LARGE ; } else { min_value = HAVOC_BLK_LARGE ; max_value = HAVOC_BLK_XL ; } } if ( min_value >= limit ) min_value = 1 ; return min_value + UR ( MIN ( max_value , limit ) - min_value + 1 ) ; }
Helper to choose random block len for block operations in fuzz_one().
Helper to choose random block len for block operations in fuzz_one () .