mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-08 16:21:32 +00:00
code format
This commit is contained in:
parent
51a346bcbe
commit
b6fa63abdf
@ -109,7 +109,8 @@
|
||||
#define CASE_PREFIX "id_"
|
||||
#endif /* ^!SIMPLE_FILES */
|
||||
|
||||
#define STAGE_BUF_SIZE (64) /* usable size of the stage name buf in afl_state */
|
||||
#define STAGE_BUF_SIZE (64) /* usable size of the stage name buf in afl_state \
|
||||
*/
|
||||
|
||||
extern s8 interesting_8[INTERESTING_8_LEN];
|
||||
extern s16 interesting_16[INTERESTING_8_LEN + INTERESTING_16_LEN];
|
||||
|
@ -394,7 +394,8 @@ u8 run_cmplog_target(afl_state_t *afl, u32 timeout) {
|
||||
/* Since we always have a forkserver (or a fauxserver) running, we can simply
|
||||
tell them to have at it and read back the pid from it.*/
|
||||
|
||||
if ((res = write(afl->cmplog_fsrv_ctl_fd, &afl->cmplog_prev_timed_out, 4)) != 4) {
|
||||
if ((res = write(afl->cmplog_fsrv_ctl_fd, &afl->cmplog_prev_timed_out, 4)) !=
|
||||
4) {
|
||||
|
||||
if (afl->stop_soon) return 0;
|
||||
RPFATAL(res,
|
||||
|
@ -196,7 +196,8 @@ u8 trim_case_custom(afl_state_t *afl, struct queue_entry *q, u8 *in_buf) {
|
||||
u32 trim_exec = 0;
|
||||
u32 orig_len = q->len;
|
||||
|
||||
if (afl->stage_name != afl->stage_name_buf) afl->stage_name = afl->stage_name_buf;
|
||||
if (afl->stage_name != afl->stage_name_buf)
|
||||
afl->stage_name = afl->stage_name_buf;
|
||||
afl->bytes_trim_in += q->len;
|
||||
|
||||
/* Initialize trimming in the custom mutator */
|
||||
|
@ -1680,7 +1680,8 @@ havoc_stage:
|
||||
perf_score = orig_perf;
|
||||
|
||||
snprintf(afl->stage_name_buf, STAGE_BUF_SIZE, "splice %u", splice_cycle);
|
||||
if (afl->stage_name != afl->stage_name_buf) afl->stage_name = afl->stage_name_buf;
|
||||
if (afl->stage_name != afl->stage_name_buf)
|
||||
afl->stage_name = afl->stage_name_buf;
|
||||
afl->stage_short = "splice";
|
||||
afl->stage_max = SPLICE_HAVOC * perf_score / afl->havoc_div / 100;
|
||||
|
||||
@ -3573,9 +3574,10 @@ pacemaker_fuzzing:
|
||||
|
||||
perf_score = orig_perf;
|
||||
|
||||
snprintf(afl->stage_name_buf, STAGE_BUF_SIZE, MOpt_globals.splice_stageformat,
|
||||
splice_cycle);
|
||||
if (afl->stage_name != afl->stage_name_buf) afl->stage_name = afl->stage_name_buf;
|
||||
snprintf(afl->stage_name_buf, STAGE_BUF_SIZE,
|
||||
MOpt_globals.splice_stageformat, splice_cycle);
|
||||
if (afl->stage_name != afl->stage_name_buf)
|
||||
afl->stage_name = afl->stage_name_buf;
|
||||
afl->stage_short = MOpt_globals.splice_stagenameshort;
|
||||
afl->stage_max = SPLICE_HAVOC * perf_score / afl->havoc_div / 100;
|
||||
|
||||
@ -3623,7 +3625,8 @@ pacemaker_fuzzing:
|
||||
} else {
|
||||
|
||||
perf_score = orig_perf;
|
||||
snprintf(afl->stage_name_buf, STAGE_BUF_SIZE, MOpt_globals.splice_stageformat, splice_cycle);
|
||||
snprintf(afl->stage_name_buf, STAGE_BUF_SIZE,
|
||||
MOpt_globals.splice_stageformat, splice_cycle);
|
||||
afl->stage_name = afl->stage_name_buf;
|
||||
afl->stage_short = MOpt_globals.splice_stagenameshort;
|
||||
afl->stage_max = SPLICE_HAVOC * perf_score / afl->havoc_div / 100;
|
||||
|
@ -361,7 +361,8 @@ u8 calibrate_case(afl_state_t *afl, struct queue_entry *q, u8 *use_mem,
|
||||
|
||||
for (i = 0; i < MAP_SIZE; ++i) {
|
||||
|
||||
if (!afl->var_bytes[i] && afl->first_trace[i] != afl->fsrv.trace_bits[i]) {
|
||||
if (!afl->var_bytes[i] &&
|
||||
afl->first_trace[i] != afl->fsrv.trace_bits[i]) {
|
||||
|
||||
afl->var_bytes[i] = 1;
|
||||
afl->stage_max = CAL_CYCLES_LONG;
|
||||
@ -500,7 +501,8 @@ void sync_fuzzers(afl_state_t *afl) {
|
||||
|
||||
snprintf(afl->stage_name_buf, STAGE_BUF_SIZE, "sync %u", ++sync_cnt);
|
||||
|
||||
if (afl->stage_name != afl->stage_name_buf) afl->stage_name = afl->stage_name_buf;
|
||||
if (afl->stage_name != afl->stage_name_buf)
|
||||
afl->stage_name = afl->stage_name_buf;
|
||||
afl->stage_cur = 0;
|
||||
afl->stage_max = 0;
|
||||
|
||||
@ -607,7 +609,8 @@ u8 trim_case(afl_state_t *afl, struct queue_entry *q, u8 *in_buf) {
|
||||
|
||||
if (q->len < 5) return 0;
|
||||
|
||||
if (afl->stage_name != afl->stage_name_buf) afl->stage_name = afl->stage_name_buf;
|
||||
if (afl->stage_name != afl->stage_name_buf)
|
||||
afl->stage_name = afl->stage_name_buf;
|
||||
afl->bytes_trim_in += q->len;
|
||||
|
||||
/* Select initial chunk len, starting with large steps. */
|
||||
@ -623,7 +626,8 @@ u8 trim_case(afl_state_t *afl, struct queue_entry *q, u8 *in_buf) {
|
||||
|
||||
u32 remove_pos = remove_len;
|
||||
|
||||
snprintf(afl->stage_name_buf, STAGE_BUF_SIZE, "trim %s/%s", DI(remove_len), DI(remove_len));
|
||||
snprintf(afl->stage_name_buf, STAGE_BUF_SIZE, "trim %s/%s", DI(remove_len),
|
||||
DI(remove_len));
|
||||
|
||||
afl->stage_cur = 0;
|
||||
afl->stage_max = q->len / remove_len;
|
||||
|
@ -205,7 +205,9 @@ void show_stats(afl_state_t *afl) {
|
||||
|
||||
/* If not enough time has passed since last UI update, bail out. */
|
||||
|
||||
if (cur_ms - afl->stats_last_ms < 1000 / UI_TARGET_HZ && !afl->force_ui_update) return;
|
||||
if (cur_ms - afl->stats_last_ms < 1000 / UI_TARGET_HZ &&
|
||||
!afl->force_ui_update)
|
||||
return;
|
||||
|
||||
/* Check if we're past the 10 minute mark. */
|
||||
|
||||
@ -215,18 +217,22 @@ void show_stats(afl_state_t *afl) {
|
||||
|
||||
if (!afl->stats_last_execs) {
|
||||
|
||||
afl->stats_avg_exec = ((double)afl->total_execs) * 1000 / (cur_ms - afl->start_time);
|
||||
afl->stats_avg_exec =
|
||||
((double)afl->total_execs) * 1000 / (cur_ms - afl->start_time);
|
||||
|
||||
} else {
|
||||
|
||||
double cur_avg = ((double)(afl->total_execs - afl->stats_last_execs)) * 1000 / (cur_ms - afl->stats_last_ms);
|
||||
double cur_avg = ((double)(afl->total_execs - afl->stats_last_execs)) *
|
||||
1000 / (cur_ms - afl->stats_last_ms);
|
||||
|
||||
/* If there is a dramatic (5x+) jump in speed, reset the indicator
|
||||
more quickly. */
|
||||
|
||||
if (cur_avg * 5 < afl->stats_avg_exec || cur_avg / 5 > afl->stats_avg_exec) afl->stats_avg_exec = cur_avg;
|
||||
if (cur_avg * 5 < afl->stats_avg_exec || cur_avg / 5 > afl->stats_avg_exec)
|
||||
afl->stats_avg_exec = cur_avg;
|
||||
|
||||
afl->stats_avg_exec = afl->stats_avg_exec * (1.0 - 1.0 / AVG_SMOOTHING) + cur_avg * (1.0 / AVG_SMOOTHING);
|
||||
afl->stats_avg_exec = afl->stats_avg_exec * (1.0 - 1.0 / AVG_SMOOTHING) +
|
||||
cur_avg * (1.0 / AVG_SMOOTHING);
|
||||
|
||||
}
|
||||
|
||||
@ -383,7 +389,8 @@ void show_stats(afl_state_t *afl) {
|
||||
|
||||
DTD(time_tmp, sizeof(time_tmp), cur_ms, afl->start_time);
|
||||
SAYF(bV bSTOP " run time : " cRST "%-33s " bSTG bV bSTOP
|
||||
" cycles done : %s%-5s " bSTG bV "\n", time_tmp, tmp, DI(afl->queue_cycle - 1));
|
||||
" cycles done : %s%-5s " bSTG bV "\n",
|
||||
time_tmp, tmp, DI(afl->queue_cycle - 1));
|
||||
|
||||
/* We want to warn people about not seeing new paths after a full cycle,
|
||||
except when resuming fuzzing or running in non-instrumented mode. */
|
||||
@ -420,14 +427,16 @@ void show_stats(afl_state_t *afl) {
|
||||
|
||||
DTD(time_tmp, sizeof(time_tmp), cur_ms, afl->last_crash_time);
|
||||
SAYF(bV bSTOP " last uniq crash : " cRST "%-33s " bSTG bV bSTOP
|
||||
" uniq crashes : %s%-6s" bSTG bV "\n", time_tmp, afl->unique_crashes ? cLRD : cRST, tmp);
|
||||
" uniq crashes : %s%-6s" bSTG bV "\n",
|
||||
time_tmp, afl->unique_crashes ? cLRD : cRST, tmp);
|
||||
|
||||
sprintf(tmp, "%s%s", DI(afl->unique_hangs),
|
||||
(afl->unique_hangs >= KEEP_UNIQUE_HANG) ? "+" : "");
|
||||
|
||||
DTD(time_tmp, sizeof(time_tmp), cur_ms, afl->last_hang_time);
|
||||
SAYF(bV bSTOP " last uniq hang : " cRST "%-33s " bSTG bV bSTOP
|
||||
" uniq hangs : " cRST "%-6s" bSTG bV "\n", time_tmp, tmp);
|
||||
" uniq hangs : " cRST "%-6s" bSTG bV "\n",
|
||||
time_tmp, tmp);
|
||||
|
||||
SAYF(bVR bH bSTOP cCYA
|
||||
" cycle progress " bSTG bH10 bH5 bH2 bH2 bHB bH bSTOP cCYA
|
||||
@ -526,7 +535,8 @@ void show_stats(afl_state_t *afl) {
|
||||
}
|
||||
|
||||
sprintf(tmp, "%s (%s%s unique)", DI(afl->total_tmouts),
|
||||
DI(afl->unique_tmouts), (afl->unique_hangs >= KEEP_UNIQUE_HANG) ? "+" : "");
|
||||
DI(afl->unique_tmouts),
|
||||
(afl->unique_hangs >= KEEP_UNIQUE_HANG) ? "+" : "");
|
||||
|
||||
SAYF(bSTG bV bSTOP " total tmouts : " cRST "%-22s" bSTG bV "\n", tmp);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user