diff options
author | van Hauser <vh@thc.org> | 2022-11-14 21:48:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 21:48:50 +0100 |
commit | 46beedadd74087cd04f1bd4928ebf2e15aeb602d (patch) | |
tree | 367162604331f429ac2cdf271dbf053b9485945e /src/afl-fuzz-redqueen.c | |
parent | 3cc5019fe492176e0cb5dbd446f1fa125ec9d7ed (diff) | |
parent | 7f7cbe962324f7af8d55423ee09635996a8c9332 (diff) | |
download | afl++-46beedadd74087cd04f1bd4928ebf2e15aeb602d.tar.gz |
Merge pull request #1580 from guyf2010/dev
Add option for random cmplog colorization
Diffstat (limited to 'src/afl-fuzz-redqueen.c')
-rw-r--r-- | src/afl-fuzz-redqueen.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/afl-fuzz-redqueen.c b/src/afl-fuzz-redqueen.c index 337f124d..0dae26a3 100644 --- a/src/afl-fuzz-redqueen.c +++ b/src/afl-fuzz-redqueen.c @@ -167,6 +167,25 @@ static u8 get_exec_checksum(afl_state_t *afl, u8 *buf, u32 len, u64 *cksum) { } +/* replace everything with different values */ +static void random_replace(afl_state_t *afl, u8 *buf, u32 len) { + + for (u32 i = 0; i < len; i++) { + + u8 c; + + do { + + c = rand_below(afl, 256); + + } while (c == buf[i]); + + buf[i] = c; + + } + +} + /* replace everything with different values but stay in the same type */ static void type_replace(afl_state_t *afl, u8 *buf, u32 len) { @@ -293,7 +312,15 @@ static u8 colorization(afl_state_t *afl, u8 *buf, u32 len, memcpy(backup, buf, len); memcpy(changed, buf, len); - type_replace(afl, changed, len); + if (afl->cmplog_random_colorization) { + + random_replace(afl, changed, len); + + } else { + + type_replace(afl, changed, len); + + } while ((rng = pop_biggest_range(&ranges)) != NULL && afl->stage_cur < afl->stage_max) { |