Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove test cases with a duplicate trace map #359

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions afl-fuzz.c
Original file line number Diff line number Diff line change
Expand Up @@ -3342,6 +3342,69 @@ static void perform_dry_run(char** argv) {

}

/* Now we remove all entries from the queue that have a duplicate trace map. */

ACTF("Removing entries with a duplicate trace map...");

q = queue;
int duplicates = 0;
struct queue_entry* p, * dup = NULL;

while (q) {

if (q->cal_failed || !q->exec_cksum) {

q = q->next;
continue;

}

p = q->next;

while (p) {

if (!p->cal_failed && p->exec_cksum == q->exec_cksum) {

duplicates = 1;
--pending_not_fuzzed;

// We keep the shorter file.
if (p->len >= q->len) {
dup = p;
p->was_fuzzed = 1;
} else {
dup = q;
q->was_fuzzed = 1;
}

WARNF("Duplicate entry '%s' was marked as fuzzed.", strrchr(dup->fname, '\\') + 1);

}

p = p->next;

}

q = q->next;

}

if (duplicates) {

ACTF("Recalculating max depth due to duplicates...");

q = queue;
max_depth = 0;

while (q) {

if (q->depth > max_depth) max_depth = q->depth;
q = q->next;

}

}

OKF("All test cases processed.");

}
Expand Down