afl-fuzz.c
static void update_queue_score(void){
  if(!(update_top_flag % 4)){
    update_good_top();
    u32 case_hash_location = 1;
    u32 tmp_hash_total = hash_total;
    while(case_hash_location < tmp_hash_total){
    //while(case_hash_location < hash_total){
	    struct hash_map * hash_index = cksum_hash_map[hash_cksum_now[case_hash_location]];
	    while(hash_index){
		    struct top_mem * score_cur = hash_index->score_queue;
        while(score_cur){
          struct queue_entry * q = score_cur->testcase;
          q->score = 0.0;
          for(u32 i_lh = 0; i_lh < TOP_NUM; i_lh++){
            if(good_top[i_lh]){
              switch (i_lh) {
                case 0: q->score += (double)((double)( exec_us_min) + 0.00000000001)/((double)(q->exec_us) + 0.00000000001); break;
                case 1: q->score += (double)((double)( q->exec_us) + 0.00000000001)/((double)(exec_us_max) + 0.00000000001); break;
                case 2: q->score += (double)((double)( q->len) + 0.00000000001)/((double)(len_max) + 0.00000000001); break;
                case 3: q->score += (double)((double)( len_min) + 0.00000000001)/((double)(q->len) + 0.00000000001); break;
                case 4: q->score += (double)((double)( q->bit_num) + 0.00000000001)/((double)(bit_num_max) + 0.00000000001); break;
                case 5: q->score += (double)((double)( q->interesting) + 0.00000000001)/((double)(interesting_max) + 0.00000000001); break;
                case 6: q->score += (double)((double)( q->cmp_const_num) + 0.00000000001)/((double)(cmp_const_num_max) + 0.00000000001); break;
                case 7: q->score += (double)((double)( q->untouch_num) + 0.00000000001)/((double)(untouch_num_max) + 0.00000000001); break;
                case 8: q->score += (double)((double)( q->mem_num) + 0.00000000001)/((double)(mem_num_max) + 0.00000000001); break;
                case 9: q->score += (double)((double)( q->depth) + 0.00000000001)/((double)(depth_max) + 0.00000000001); break;
                case 10: q->score += (double)((double)( q->func_num) + 0.00000000001)/((double)(func_num_max) + 0.00000000001); break;
                case 11: q->score += (double)((double)( q->loop_num) + 0.00000000001)/((double)(loop_num_max) + 0.00000000001); break;
                case 12: q->score += (double)((double)( q->global_num) + 0.00000000001)/((double)(global_num_max) + 0.00000000001); break;
                case 13: q->score += (double)((double)( q->global_assign_num) + 0.00000000001)/((double)(global_assign_num_max) + 0.00000000001); break;
                case 14: q->score += (double)((double)( q->bug_num) + 0.00000000001)/((double)(bug_num_max) + 0.00000000001); break;
                case 15: q->score += (double)((double)( q->edge_change_efficiency) + 0.00000000001)/((double)(edge_change_efficiency_max) + 0.00000000001); break;
                case 16: q->score += (double)((double)( exec_num_min) + 0.00000000001)/((double)(q->exec_num) + 0.00000000001); break;
                default: break;
              }
            }
          }   
          score_cur = score_cur->next;
        }
		    hash_index = hash_index->next;
	    }
	    case_hash_location++;
    }
    readjust_case_order();
  }
  if(!score_flag) score_flag = 1;
}
/* Update the score of the case and re-adjust the case order in score_queue according to the modified score. Created by LH. */
Update the score of the case and re-adjust the case order in score_queue according to the modified score. Created by LH.
Update the score of the case and re - adjust the case order in score_queue according to the modified score . Created by LH .
static void update_queue_score(void){
  if(!(update_top_flag % 4)){
    update_good_top();
    u32 case_hash_location = 1;
    u32 tmp_hash_total = hash_total;
    while(case_hash_location < tmp_hash_total){
	    struct hash_map * hash_index = cksum_hash_map[hash_cksum_now[case_hash_location]];
	    while(hash_index){
		    struct top_mem * score_cur = hash_index->score_queue;
        while(score_cur){
          struct queue_entry * q = score_cur->testcase;
          q->score = 0.0;
          for(u32 i_lh = 0; i_lh < TOP_NUM; i_lh++){
            if(good_top[i_lh]){
              switch (i_lh) {
                case 0: q->score += (double)((double)( exec_us_min) + 0.00000000001)/((double)(q->exec_us) + 0.00000000001); break;
                case 1: q->score += (double)((double)( q->exec_us) + 0.00000000001)/((double)(exec_us_max) + 0.00000000001); break;
                case 2: q->score += (double)((double)( q->len) + 0.00000000001)/((double)(len_max) + 0.00000000001); break;
                case 3: q->score += (double)((double)( len_min) + 0.00000000001)/((double)(q->len) + 0.00000000001); break;
                case 4: q->score += (double)((double)( q->bit_num) + 0.00000000001)/((double)(bit_num_max) + 0.00000000001); break;
                case 5: q->score += (double)((double)( q->interesting) + 0.00000000001)/((double)(interesting_max) + 0.00000000001); break;
                case 6: q->score += (double)((double)( q->cmp_const_num) + 0.00000000001)/((double)(cmp_const_num_max) + 0.00000000001); break;
                case 7: q->score += (double)((double)( q->untouch_num) + 0.00000000001)/((double)(untouch_num_max) + 0.00000000001); break;
                case 8: q->score += (double)((double)( q->mem_num) + 0.00000000001)/((double)(mem_num_max) + 0.00000000001); break;
                case 9: q->score += (double)((double)( q->depth) + 0.00000000001)/((double)(depth_max) + 0.00000000001); break;
                case 10: q->score += (double)((double)( q->func_num) + 0.00000000001)/((double)(func_num_max) + 0.00000000001); break;
                case 11: q->score += (double)((double)( q->loop_num) + 0.00000000001)/((double)(loop_num_max) + 0.00000000001); break;
                case 12: q->score += (double)((double)( q->global_num) + 0.00000000001)/((double)(global_num_max) + 0.00000000001); break;
                case 13: q->score += (double)((double)( q->global_assign_num) + 0.00000000001)/((double)(global_assign_num_max) + 0.00000000001); break;
                case 14: q->score += (double)((double)( q->bug_num) + 0.00000000001)/((double)(bug_num_max) + 0.00000000001); break;
                case 15: q->score += (double)((double)( q->edge_change_efficiency) + 0.00000000001)/((double)(edge_change_efficiency_max) + 0.00000000001); break;
                case 16: q->score += (double)((double)( exec_num_min) + 0.00000000001)/((double)(q->exec_num) + 0.00000000001); break;
                default: break;
              }
            }
          }   
          score_cur = score_cur->next;
        }
		    hash_index = hash_index->next;
	    }
	    case_hash_location++;
    }
    readjust_case_order();
  }
  if(!score_flag) score_flag = 1;
}
static void update_queue_score ( void ) { if ( ! ( update_top_flag % 4 ) ) { update_good_top ( ) ; u32 case_hash_location = 1 ; u32 tmp_hash_total = hash_total ; while ( case_hash_location < tmp_hash_total ) { struct hash_map * hash_index = cksum_hash_map [ hash_cksum_now [ case_hash_location ] ] ; while ( hash_index ) { struct top_mem * score_cur = hash_index -> score_queue ; while ( score_cur ) { struct queue_entry * q = score_cur -> testcase ; q -> score = 0.0 ; for ( u32 i_lh = 0 ; i_lh < TOP_NUM ; i_lh ++ ) { if ( good_top [ i_lh ] ) { switch ( i_lh ) { case 0 : q -> score += ( double ) ( ( double ) ( exec_us_min ) + 0.00000000001 ) / ( ( double ) ( q -> exec_us ) + 0.00000000001 ) ; break ; case 1 : q -> score += ( double ) ( ( double ) ( q -> exec_us ) + 0.00000000001 ) / ( ( double ) ( exec_us_max ) + 0.00000000001 ) ; break ; case 2 : q -> score += ( double ) ( ( double ) ( q -> len ) + 0.00000000001 ) / ( ( double ) ( len_max ) + 0.00000000001 ) ; break ; case 3 : q -> score += ( double ) ( ( double ) ( len_min ) + 0.00000000001 ) / ( ( double ) ( q -> len ) + 0.00000000001 ) ; break ; case 4 : q -> score += ( double ) ( ( double ) ( q -> bit_num ) + 0.00000000001 ) / ( ( double ) ( bit_num_max ) + 0.00000000001 ) ; break ; case 5 : q -> score += ( double ) ( ( double ) ( q -> interesting ) + 0.00000000001 ) / ( ( double ) ( interesting_max ) + 0.00000000001 ) ; break ; case 6 : q -> score += ( double ) ( ( double ) ( q -> cmp_const_num ) + 0.00000000001 ) / ( ( double ) ( cmp_const_num_max ) + 0.00000000001 ) ; break ; case 7 : q -> score += ( double ) ( ( double ) ( q -> untouch_num ) + 0.00000000001 ) / ( ( double ) ( untouch_num_max ) + 0.00000000001 ) ; break ; case 8 : q -> score += ( double ) ( ( double ) ( q -> mem_num ) + 0.00000000001 ) / ( ( double ) ( mem_num_max ) + 0.00000000001 ) ; break ; case 9 : q -> score += ( double ) ( ( double ) ( q -> depth ) + 0.00000000001 ) / ( ( double ) ( depth_max ) + 0.00000000001 ) ; break ; case 10 : q -> score += ( double ) ( ( double ) ( q -> func_num ) + 0.00000000001 ) / ( ( double ) ( func_num_max ) + 0.00000000001 ) ; break ; case 11 : q -> score += ( double ) ( ( double ) ( q -> loop_num ) + 0.00000000001 ) / ( ( double ) ( loop_num_max ) + 0.00000000001 ) ; break ; case 12 : q -> score += ( double ) ( ( double ) ( q -> global_num ) + 0.00000000001 ) / ( ( double ) ( global_num_max ) + 0.00000000001 ) ; break ; case 13 : q -> score += ( double ) ( ( double ) ( q -> global_assign_num ) + 0.00000000001 ) / ( ( double ) ( global_assign_num_max ) + 0.00000000001 ) ; break ; case 14 : q -> score += ( double ) ( ( double ) ( q -> bug_num ) + 0.00000000001 ) / ( ( double ) ( bug_num_max ) + 0.00000000001 ) ; break ; case 15 : q -> score += ( double ) ( ( double ) ( q -> edge_change_efficiency ) + 0.00000000001 ) / ( ( double ) ( edge_change_efficiency_max ) + 0.00000000001 ) ; break ; case 16 : q -> score += ( double ) ( ( double ) ( exec_num_min ) + 0.00000000001 ) / ( ( double ) ( q -> exec_num ) + 0.00000000001 ) ; break ; default : break ; } } } score_cur = score_cur -> next ; } hash_index = hash_index -> next ; } case_hash_location ++ ; } readjust_case_order ( ) ; } if ( ! score_flag ) score_flag = 1 ; }
Update the score of the case and re-adjust the case order in score_queue according to the modified score.
Update the score of the case and re - adjust the case order in score_queue according to the modified score .
//while(case_hash_location < hash_total){