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

Fix use of afl_hash_ip #22

Merged
merged 1 commit into from
Oct 21, 2023
Merged
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
8 changes: 4 additions & 4 deletions unicornafl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class UCAFL {
uc_afl_ret fsrv_run() {
uc_afl_ret ret;
this->_may_use_shm_testcase();
this->_afl_steup();
this->_afl_setup();
if (this->has_afl_) {
this->_uc_setup();
}
Expand Down Expand Up @@ -333,7 +333,7 @@ class UCAFL {

static void _uc_hook_block(uc_engine* uc, uint64_t address, uint32_t size,
void* user_data) {
uint64_t cur_loc = afl_hash_ip(address);
uint64_t cur_loc = afl_hash_ip(address) & (MAP_SIZE - 1);
UCAFL* ucafl = (UCAFL*)user_data;

ucafl->afl_area_ptr_[cur_loc ^ ucafl->afl_prev_loc_]++;
Expand Down Expand Up @@ -413,7 +413,7 @@ class UCAFL {
uint64_t arg2, uint32_t size,
void* user_data) {
UCAFL* ucafl = (UCAFL*)user_data;
uint64_t cur_loc = ((address >> 4) ^ (address << 8)) & (MAP_SIZE - 7);
uint64_t cur_loc = afl_hash_ip(address) & (MAP_SIZE - 1);

if (unlikely(cur_loc >= ucafl->afl_inst_rms_)) {
return;
Expand Down Expand Up @@ -475,7 +475,7 @@ class UCAFL {
}
}

void _afl_steup() {
void _afl_setup() {
char* map_id_str = getenv(SHM_ENV_VAR);
char* inst_r_str = getenv("AFL_INST_RATIO");

Expand Down
Loading