aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-02-07 07:51:29 +0100
committervanhauser-thc <vh@thc.org>2021-02-07 07:51:29 +0100
commit0ad56167c53ae660d40ccc6cdedb39f0a52eefcd (patch)
treedf45cbcd663a12cc96670cf8e72ba72f90fa37ef /src
parentaeb7d7048371cd91ab9280c3958f1c35e5d5e758 (diff)
downloadafl++-0ad56167c53ae660d40ccc6cdedb39f0a52eefcd.tar.gz
fix scan-build issues
Diffstat (limited to 'src')
-rw-r--r--src/afl-cc.c7
-rw-r--r--src/afl-fuzz-init.c2
-rw-r--r--src/afl-fuzz-redqueen.c36
3 files changed, 32 insertions, 13 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c
index 76f4a437..0ae401e7 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -315,16 +315,9 @@ static void edit_params(u32 argc, char **argv, char **envp) {
u8 fortify_set = 0, asan_set = 0, x_set = 0, bit_mode = 0, shared_linking = 0,
preprocessor_only = 0, have_unroll = 0, have_o = 0, have_pic = 0,
have_c = 0;
- u8 *name;
cc_params = ck_alloc((argc + 128) * sizeof(u8 *));
- name = strrchr(argv[0], '/');
- if (!name)
- name = argv[0];
- else
- ++name;
-
if (lto_mode) {
if (lto_flag[0] != '-')
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c
index 40ba20c7..702e732d 100644
--- a/src/afl-fuzz-init.c
+++ b/src/afl-fuzz-init.c
@@ -1242,7 +1242,7 @@ static void link_or_copy(u8 *old_path, u8 *new_path) {
void pivot_inputs(afl_state_t *afl) {
- struct queue_entry *q = afl->queue;
+ struct queue_entry *q;
u32 id = 0, i;
ACTF("Creating hard links for all input files...");
diff --git a/src/afl-fuzz-redqueen.c b/src/afl-fuzz-redqueen.c
index f619a6d3..002929c5 100644
--- a/src/afl-fuzz-redqueen.c
+++ b/src/afl-fuzz-redqueen.c
@@ -1415,7 +1415,7 @@ static void try_to_add_to_dict(afl_state_t *afl, u64 v, u8 shape) {
} else if (b[k] == 0xff) {
- ++cons_0;
+ ++cons_ff;
} else {
@@ -1473,7 +1473,7 @@ static void try_to_add_to_dictN(afl_state_t *afl, u128 v, u8 size) {
} else if (b[k] == 0xff) {
- ++cons_0;
+ ++cons_ff;
} else {
@@ -2410,7 +2410,21 @@ u8 input_to_state_stage(afl_state_t *afl, u8 *orig_buf, u8 *buf, u32 len) {
// manually clear the full cmp_map
memset(afl->shm.cmp_map, 0, sizeof(struct cmp_map));
- if (unlikely(common_fuzz_cmplog_stuff(afl, orig_buf, len))) { return 1; }
+ if (unlikely(common_fuzz_cmplog_stuff(afl, orig_buf, len))) {
+
+ afl->queue_cur->colorized = CMPLOG_LVL_MAX;
+ while (taint) {
+
+ t = taint->next;
+ ck_free(taint);
+ taint = t;
+
+ }
+
+ return 1;
+
+ }
+
if (unlikely(!afl->orig_cmp_map)) {
afl->orig_cmp_map = ck_alloc_nozero(sizeof(struct cmp_map));
@@ -2419,7 +2433,20 @@ u8 input_to_state_stage(afl_state_t *afl, u8 *orig_buf, u8 *buf, u32 len) {
memcpy(afl->orig_cmp_map, afl->shm.cmp_map, sizeof(struct cmp_map));
memset(afl->shm.cmp_map->headers, 0, sizeof(struct cmp_header) * CMP_MAP_W);
- if (unlikely(common_fuzz_cmplog_stuff(afl, buf, len))) { return 1; }
+ if (unlikely(common_fuzz_cmplog_stuff(afl, buf, len))) {
+
+ afl->queue_cur->colorized = CMPLOG_LVL_MAX;
+ while (taint) {
+
+ t = taint->next;
+ ck_free(taint);
+ taint = t;
+
+ }
+
+ return 1;
+
+ }
#ifdef _DEBUG
dump("ORIG", orig_buf, len);
@@ -2530,7 +2557,6 @@ exit_its:
afl->queue_cur->colorized = CMPLOG_LVL_MAX;
ck_free(afl->queue_cur->cmplog_colorinput);
- t = taint;
while (taint) {
t = taint->next;