final changes for pre-3.0

This commit is contained in:
vanhauser-thc
2020-09-05 13:18:28 +02:00
parent 4b3ad5f037
commit e30b2c6af6
27 changed files with 188 additions and 216 deletions

View File

@ -626,6 +626,7 @@ if (dir == NULL) {
if (!access(fn1, F_OK)) {
afl->in_dir = fn1;
subdirs = 0;
} else {
@ -1063,7 +1064,7 @@ restart_outer_cull_loop:
}
afl->q_prev100 = afl->queue = afl->queue_top = afl->queue;
afl->queue = afl->queue_top = afl->queue;
}

View File

@ -138,8 +138,7 @@ static u8 check_if_text(struct queue_entry *q) {
}
// non-overlong 2-byte
if (len - offset > 1 &&
((0xC2 <= buf[offset + 0] && buf[offset + 0] <= 0xDF) &&
if (len - offset > 1 && ((0xC2 <= buf[offset + 0] && buf[offset + 0] <= 0xDF) &&
(0x80 <= buf[offset + 1] && buf[offset + 1] <= 0xBF))) {
offset += 2;
@ -230,7 +229,7 @@ void add_to_queue(afl_state_t *afl, u8 *fname, u32 len, u8 passed_det) {
} else {
afl->q_prev100 = afl->queue = afl->queue_top = q;
afl->queue = afl->queue_top = q;
}
@ -274,15 +273,15 @@ void add_to_queue(afl_state_t *afl, u8 *fname, u32 len, u8 passed_det) {
void destroy_queue(afl_state_t *afl) {
struct queue_entry *q = afl->queue, *n;
struct queue_entry *q;
u32 i;
while (q) {
for (i = 0; i < afl->queued_paths; i++) {
n = q->next;
q = afl->queue_buf[i];
ck_free(q->fname);
ck_free(q->trace_mini);
ck_free(q);
q = n;
}

View File

@ -982,10 +982,9 @@ void show_stats(afl_state_t *afl) {
void show_init_stats(afl_state_t *afl) {
struct queue_entry *q = afl->queue;
u32 min_bits = 0, max_bits = 0;
u32 min_bits = 0, max_bits = 0, max_len = 0, count = 0;
u64 min_us = 0, max_us = 0;
u64 avg_us = 0;
u32 max_len = 0;
u8 val_bufs[4][STRINGIFY_VAL_SIZE_MAX];
#define IB(i) val_bufs[(i)], sizeof(val_bufs[(i)])
@ -1006,6 +1005,7 @@ void show_init_stats(afl_state_t *afl) {
if (q->len > max_len) { max_len = q->len; }
++count;
q = q->next;
}
@ -1072,10 +1072,10 @@ void show_init_stats(afl_state_t *afl) {
OKF("Here are some useful stats:\n\n"
cGRA " Test case count : " cRST
"%u favored, %u variable, %u total\n" cGRA " Bitmap range : " cRST
"%u favored, %u variable, %u ignored, %u total\n" cGRA " Bitmap range : " cRST
"%u to %u bits (average: %0.02f bits)\n" cGRA
" Exec timing : " cRST "%s to %s us (average: %s us)\n",
afl->queued_favored, afl->queued_variable, afl->queued_paths, min_bits,
afl->queued_favored, afl->queued_variable, afl->queued_paths - count, afl->queued_paths, min_bits,
max_bits,
((double)afl->total_bitmap_size) /
(afl->total_bitmap_entries ? afl->total_bitmap_entries : 1),

View File

@ -1133,8 +1133,9 @@ int main(int argc, char **argv_orig, char **envp) {
setup_cmdline_file(afl, argv + optind);
read_testcases(afl);
read_testcases(afl, NULL);
// read_foreign_testcases(afl, 1); for the moment dont do this
OKF("Loaded a total of %u seeds.", afl->queued_paths);
load_auto(afl);