fixed gcc analyzer warnings

This commit is contained in:
Dominik Maier
2020-12-11 13:29:45 +01:00
parent d5ded820e5
commit 609f3d0265
5 changed files with 48 additions and 14 deletions

View File

@ -94,9 +94,9 @@ write_to_testcase(afl_state_t *afl, void *mem, u32 len) {
if (unlikely(afl->custom_mutators_count)) {
u8 * new_buf = NULL;
ssize_t new_size = len;
void * new_mem = mem;
u8 * new_mem = mem;
u8 * new_buf = NULL;
LIST_FOREACH(&afl->custom_mutator_list, struct custom_mutator, {
@ -152,13 +152,13 @@ static void write_with_gap(afl_state_t *afl, u8 *mem, u32 len, u32 skip_at,
if (unlikely(!mem_trimmed)) { PFATAL("alloc"); }
ssize_t new_size = len - skip_len;
void * new_mem = mem;
u8 * new_buf = NULL;
u8 * new_mem = mem;
bool post_process_skipped = true;
if (unlikely(afl->custom_mutators_count)) {
u8 *new_buf = NULL;
new_mem = mem_trimmed;
LIST_FOREACH(&afl->custom_mutator_list, struct custom_mutator, {
@ -207,7 +207,7 @@ static void write_with_gap(afl_state_t *afl, u8 *mem, u32 len, u32 skip_at,
// If we did post_processing, copy directly from the new_buf bufer
memcpy(afl->fsrv.shmem_fuzz, new_buf, new_size);
memcpy(afl->fsrv.shmem_fuzz, new_mem, new_size);
}
@ -265,7 +265,7 @@ static void write_with_gap(afl_state_t *afl, u8 *mem, u32 len, u32 skip_at,
if (!post_process_skipped) {
ck_write(fd, new_buf, new_size, afl->fsrv.out_file);
ck_write(fd, new_mem, new_size, afl->fsrv.out_file);
} else {