diff options
author | van Hauser <vh@thc.org> | 2020-08-09 12:15:36 +0200 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2020-08-09 12:15:36 +0200 |
commit | a1129b67c22ff54e25d457efbe44b3ab11851b5b (patch) | |
tree | e1e0402f2d5165b156f6cd7b21621f0bbe56643d /src/afl-fuzz-bitmap.c | |
parent | 0bb59ba11606e0382126304f78507efe7d62fd6b (diff) | |
download | afl++-a1129b67c22ff54e25d457efbe44b3ab11851b5b.tar.gz |
changes
Diffstat (limited to 'src/afl-fuzz-bitmap.c')
-rw-r--r-- | src/afl-fuzz-bitmap.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c index 9cb1b83f..8aaa4ae1 100644 --- a/src/afl-fuzz-bitmap.c +++ b/src/afl-fuzz-bitmap.c @@ -235,6 +235,29 @@ u32 count_bytes(afl_state_t *afl, u8 *mem) { } +u32 count_bytes_len(afl_state_t *afl, u8 *mem, u32 len) { + + u32 *ptr = (u32 *)mem; + u32 i = (len >> 2); + u32 ret = 0; + + while (i--) { + + u32 v = *(ptr++); + + if (!v) { continue; } + if (v & 0x000000ff) { ++ret; } + if (v & 0x0000ff00) { ++ret; } + if (v & 0x00ff0000) { ++ret; } + if (v & 0xff000000) { ++ret; } + + } + + return ret; + +} + + /* Count the number of non-255 bytes set in the bitmap. Used strictly for the status screen, several calls per second or so. */ |