map size fixes

This commit is contained in:
van Hauser
2019-08-01 15:44:10 +02:00
parent 487a87df02
commit af823d6486
3 changed files with 5 additions and 6 deletions

View File

@ -18,6 +18,7 @@ Version ++2.53d (dev):
---------------------- ----------------------
- custom mutator by a loaded library is now supported (thanks to kyakdan!) - custom mutator by a loaded library is now supported (thanks to kyakdan!)
- fix for a few features to support different map sized than 2^16
- afl-showmap: new option -r now shows the real values in the buckets (stock - afl-showmap: new option -r now shows the real values in the buckets (stock
afl never did), plus shows tuple content summary information now afl never did), plus shows tuple content summary information now
- fix building on *BSD (thanks to tobias.kortkamp for the patch) - fix building on *BSD (thanks to tobias.kortkamp for the patch)

View File

@ -46,15 +46,13 @@ namespace {
std::mt19937 generator; std::mt19937 generator;
int total_instr = 0; int total_instr = 0;
unsigned genLabel() { unsigned int genLabel() {
return generator() % 65536; return generator() &= MAP_SIZE - 1;
} }
public: public:
static char ID; static char ID;
InsTrim() : ModulePass(ID), generator(0) {//} InsTrim() : ModulePass(ID), generator(0) {
// AFLCoverage() : ModulePass(ID) {
char* instWhiteListFilename = getenv("AFL_LLVM_WHITELIST"); char* instWhiteListFilename = getenv("AFL_LLVM_WHITELIST");
if (instWhiteListFilename) { if (instWhiteListFilename) {
std::string line; std::string line;

View File

@ -57,7 +57,7 @@
/* This is equivalent to afl-as.h: */ /* This is equivalent to afl-as.h: */
static unsigned char dummy[65536]; /* costs 64kb but saves a few instructions */ static unsigned char dummy[MAP_SIZE]; /* costs MAP_SIZE but saves a few instructions */
unsigned char *afl_area_ptr = dummy; /* Exported for afl_gen_trace */ unsigned char *afl_area_ptr = dummy; /* Exported for afl_gen_trace */
/* Exported variables populated by the code patched into elfload.c: */ /* Exported variables populated by the code patched into elfload.c: */