code-format

This commit is contained in:
vanhauser-thc 2020-09-05 13:19:19 +02:00
parent e30b2c6af6
commit 2f90f2faba
3 changed files with 24 additions and 18 deletions

View File

@ -617,24 +617,27 @@ void read_testcases(afl_state_t *afl, u8 *directory) {
s32 nl_cnt, subdirs = 1; s32 nl_cnt, subdirs = 1;
u32 i; u32 i;
u8 * fn1, *dir = directory; u8 * fn1, *dir = directory;
u8 val_buf[2][STRINGIFY_VAL_SIZE_MAX]; u8 val_buf[2][STRINGIFY_VAL_SIZE_MAX];
/* Auto-detect non-in-place resumption attempts. */ /* Auto-detect non-in-place resumption attempts. */
if (dir == NULL) { if (dir == NULL) {
fn1 = alloc_printf("%s/queue", afl->in_dir);
if (!access(fn1, F_OK)) {
afl->in_dir = fn1; fn1 = alloc_printf("%s/queue", afl->in_dir);
subdirs = 0; if (!access(fn1, F_OK)) {
} else { afl->in_dir = fn1;
subdirs = 0;
ck_free(fn1); } else {
ck_free(fn1);
}
dir = afl->in_dir;
} }
dir = afl->in_dir;
}
ACTF("Scanning '%s'...", dir); ACTF("Scanning '%s'...", dir);

View File

@ -138,7 +138,8 @@ static u8 check_if_text(struct queue_entry *q) {
} }
// non-overlong 2-byte // 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))) { (0x80 <= buf[offset + 1] && buf[offset + 1] <= 0xBF))) {
offset += 2; offset += 2;

View File

@ -35,12 +35,12 @@ void write_setup_file(afl_state_t *afl, u32 argc, char **argv) {
u8 fn[PATH_MAX]; u8 fn[PATH_MAX];
snprintf(fn, PATH_MAX, "%s/fuzzer_setup", afl->out_dir); snprintf(fn, PATH_MAX, "%s/fuzzer_setup", afl->out_dir);
FILE *f = create_ffile(fn); FILE *f = create_ffile(fn);
u32 i; u32 i;
fprintf(f, "# environment variables:\n"); fprintf(f, "# environment variables:\n");
u32 s_afl_env = (u32) u32 s_afl_env = (u32)sizeof(afl_environment_variables) /
sizeof(afl_environment_variables) / sizeof(afl_environment_variables[0]) - sizeof(afl_environment_variables[0]) -
1U; 1U;
for (i = 0; i < s_afl_env; ++i) { for (i = 0; i < s_afl_env; ++i) {
@ -75,6 +75,7 @@ void write_setup_file(afl_state_t *afl, u32 argc, char **argv) {
} }
} }
fprintf(f, "\n"); fprintf(f, "\n");
fclose(f); fclose(f);
@ -1072,11 +1073,12 @@ void show_init_stats(afl_state_t *afl) {
OKF("Here are some useful stats:\n\n" OKF("Here are some useful stats:\n\n"
cGRA " Test case count : " cRST cGRA " Test case count : " cRST
"%u favored, %u variable, %u ignored, %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 "%u to %u bits (average: %0.02f bits)\n" cGRA
" Exec timing : " cRST "%s to %s us (average: %s us)\n", " Exec timing : " cRST "%s to %s us (average: %s us)\n",
afl->queued_favored, afl->queued_variable, afl->queued_paths - count, afl->queued_paths, min_bits, afl->queued_favored, afl->queued_variable, afl->queued_paths - count,
max_bits, afl->queued_paths, min_bits, max_bits,
((double)afl->total_bitmap_size) / ((double)afl->total_bitmap_size) /
(afl->total_bitmap_entries ? afl->total_bitmap_entries : 1), (afl->total_bitmap_entries ? afl->total_bitmap_entries : 1),
stringify_int(IB(0), min_us), stringify_int(IB(1), max_us), stringify_int(IB(0), min_us), stringify_int(IB(1), max_us),