mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-09 00:31:33 +00:00
next_p2 replaced by next_pow2
This commit is contained in:
parent
25d6d21617
commit
d611e7d50e
@ -184,7 +184,7 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) {
|
|||||||
|
|
||||||
u32 i;
|
u32 i;
|
||||||
u64 fav_factor;
|
u64 fav_factor;
|
||||||
u64 fuzz_p2 = next_p2(q->n_fuzz);
|
u64 fuzz_p2 = next_pow2(q->n_fuzz);
|
||||||
|
|
||||||
if (afl->schedule == MMOPT || afl->schedule == RARE)
|
if (afl->schedule == MMOPT || afl->schedule == RARE)
|
||||||
fav_factor = q->len << 2;
|
fav_factor = q->len << 2;
|
||||||
@ -201,7 +201,7 @@ void update_bitmap_score(afl_state_t *afl, struct queue_entry *q) {
|
|||||||
|
|
||||||
/* Faster-executing or smaller test cases are favored. */
|
/* Faster-executing or smaller test cases are favored. */
|
||||||
u64 top_rated_fav_factor;
|
u64 top_rated_fav_factor;
|
||||||
u64 top_rated_fuzz_p2 = next_p2(afl->top_rated[i]->n_fuzz);
|
u64 top_rated_fuzz_p2 = next_pow2(afl->top_rated[i]->n_fuzz);
|
||||||
|
|
||||||
if (afl->schedule == MMOPT || afl->schedule == RARE)
|
if (afl->schedule == MMOPT || afl->schedule == RARE)
|
||||||
top_rated_fav_factor = afl->top_rated[i]->len << 2;
|
top_rated_fav_factor = afl->top_rated[i]->len << 2;
|
||||||
@ -440,7 +440,7 @@ u32 calculate_score(afl_state_t *afl, struct queue_entry *q) {
|
|||||||
if (q->fuzz_level < 16)
|
if (q->fuzz_level < 16)
|
||||||
factor = ((u32)(1 << q->fuzz_level)) / (fuzz == 0 ? 1 : fuzz);
|
factor = ((u32)(1 << q->fuzz_level)) / (fuzz == 0 ? 1 : fuzz);
|
||||||
else
|
else
|
||||||
factor = MAX_FACTOR / (fuzz == 0 ? 1 : next_p2(fuzz));
|
factor = MAX_FACTOR / (fuzz == 0 ? 1 : next_pow2(fuzz));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LIN: factor = q->fuzz_level / (fuzz == 0 ? 1 : fuzz); break;
|
case LIN: factor = q->fuzz_level / (fuzz == 0 ? 1 : fuzz); break;
|
||||||
|
@ -608,7 +608,7 @@ u8 trim_case(afl_state_t *afl, struct queue_entry *q, u8 *in_buf) {
|
|||||||
|
|
||||||
/* Select initial chunk len, starting with large steps. */
|
/* Select initial chunk len, starting with large steps. */
|
||||||
|
|
||||||
len_p2 = next_p2(q->len);
|
len_p2 = next_pow2(q->len);
|
||||||
|
|
||||||
remove_len = MAX(len_p2 / TRIM_START_STEPS, TRIM_MIN_BYTES);
|
remove_len = MAX(len_p2 / TRIM_START_STEPS, TRIM_MIN_BYTES);
|
||||||
|
|
||||||
@ -653,7 +653,7 @@ u8 trim_case(afl_state_t *afl, struct queue_entry *q, u8 *in_buf) {
|
|||||||
u32 move_tail = q->len - remove_pos - trim_avail;
|
u32 move_tail = q->len - remove_pos - trim_avail;
|
||||||
|
|
||||||
q->len -= trim_avail;
|
q->len -= trim_avail;
|
||||||
len_p2 = next_p2(q->len);
|
len_p2 = next_pow2(q->len);
|
||||||
|
|
||||||
memmove(in_buf + remove_pos, in_buf + remove_pos + trim_avail,
|
memmove(in_buf + remove_pos, in_buf + remove_pos + trim_avail,
|
||||||
move_tail);
|
move_tail);
|
||||||
|
@ -404,17 +404,6 @@ static u8 run_target(afl_forkserver_t *fsrv, char **argv, u8 *mem, u32 len,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find first power of two greater or equal to val. */
|
|
||||||
|
|
||||||
static u32 next_p2(u32 val) {
|
|
||||||
|
|
||||||
u32 ret = 1;
|
|
||||||
while (val > ret)
|
|
||||||
ret <<= 1;
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Actually minimize! */
|
/* Actually minimize! */
|
||||||
|
|
||||||
static void minimize(afl_forkserver_t *fsrv, char **argv) {
|
static void minimize(afl_forkserver_t *fsrv, char **argv) {
|
||||||
@ -432,7 +421,7 @@ static void minimize(afl_forkserver_t *fsrv, char **argv) {
|
|||||||
* BLOCK NORMALIZATION *
|
* BLOCK NORMALIZATION *
|
||||||
***********************/
|
***********************/
|
||||||
|
|
||||||
set_len = next_p2(in_len / TMIN_SET_STEPS);
|
set_len = next_pow2(in_len / TMIN_SET_STEPS);
|
||||||
set_pos = 0;
|
set_pos = 0;
|
||||||
|
|
||||||
if (set_len < TMIN_SET_MIN_SIZE) set_len = TMIN_SET_MIN_SIZE;
|
if (set_len < TMIN_SET_MIN_SIZE) set_len = TMIN_SET_MIN_SIZE;
|
||||||
@ -482,7 +471,7 @@ next_pass:
|
|||||||
* BLOCK DELETION *
|
* BLOCK DELETION *
|
||||||
******************/
|
******************/
|
||||||
|
|
||||||
del_len = next_p2(in_len / TRIM_START_STEPS);
|
del_len = next_pow2(in_len / TRIM_START_STEPS);
|
||||||
stage_o_len = in_len;
|
stage_o_len = in_len;
|
||||||
|
|
||||||
ACTF(cBRI "Stage #1: " cRST "Removing blocks of data...");
|
ACTF(cBRI "Stage #1: " cRST "Removing blocks of data...");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user