mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-06 15:21:32 +00:00
code format
This commit is contained in:
parent
7f7d5ff29b
commit
3ee3b5c384
@ -432,7 +432,7 @@ and the mapping size to the called program. */
|
||||
|
||||
/* Default size of the shared memory fuzz map.
|
||||
We add 4 byte for one u32 length field. */
|
||||
#define SHM_FUZZ_MAP_SIZE_DEFAULT (MAX_FILE + 4)
|
||||
#define SHM_FUZZ_MAP_SIZE_DEFAULT (MAX_FILE + 4)
|
||||
|
||||
/* Other less interesting, internal-only variables. */
|
||||
|
||||
|
@ -297,16 +297,20 @@ static void __afl_map_shm_fuzz() {
|
||||
|
||||
// Newer afl-fuzz versions will set a shm_fuzz page size env, else fall back
|
||||
size_t shm_fuzz_map_size = SHM_FUZZ_MAP_SIZE_DEFAULT;
|
||||
char *map_size_env = getenv(SHM_FUZZ_MAP_SIZE_ENV_VAR);
|
||||
char *map_size_env = getenv(SHM_FUZZ_MAP_SIZE_ENV_VAR);
|
||||
if (map_size_env != NULL) {
|
||||
char* endptr;
|
||||
|
||||
char *endptr;
|
||||
errno = 0;
|
||||
shm_fuzz_map_size = (size_t)strtoul(map_size_env, &endptr, 10);
|
||||
if (errno != 0 || shm_fuzz_map_size == 0) {
|
||||
|
||||
perror("shm_fuzz mapping size parsing");
|
||||
send_forkserver_error(FS_ERROR_SHM_OPEN);
|
||||
_exit(1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const char *shm_file_path = id_str;
|
||||
@ -322,8 +326,7 @@ static void __afl_map_shm_fuzz() {
|
||||
|
||||
}
|
||||
|
||||
map =
|
||||
(u8 *)mmap(0, shm_fuzz_map_size, PROT_READ, MAP_SHARED, shm_fd, 0);
|
||||
map = (u8 *)mmap(0, shm_fuzz_map_size, PROT_READ, MAP_SHARED, shm_fd, 0);
|
||||
|
||||
#else
|
||||
u32 shm_id = atoi(id_str);
|
||||
|
@ -1412,7 +1412,6 @@ void perform_dry_run(afl_state_t *afl) {
|
||||
|
||||
q = afl->queue_buf[idx];
|
||||
if (!q || q->disabled || q->cal_failed || !q->exec_cksum) { continue; }
|
||||
u32 done = 0;
|
||||
|
||||
for (i = idx + 1; likely(i < afl->queued_items && afl->queue_buf[i]); ++i) {
|
||||
|
||||
@ -2903,7 +2902,7 @@ void setup_testcase_shmem(afl_state_t *afl) {
|
||||
|
||||
// we need to set the non-instrumented mode to not overwrite the SHM_ENV_VAR
|
||||
size_t shm_fuzz_map_size = SHM_FUZZ_MAP_SIZE_DEFAULT;
|
||||
u8 *map = afl_shm_init(afl->shm_fuzz, shm_fuzz_map_size, 1);
|
||||
u8 *map = afl_shm_init(afl->shm_fuzz, shm_fuzz_map_size, 1);
|
||||
afl->shm_fuzz->shmemfuzz_mode = 1;
|
||||
|
||||
if (!map) { FATAL("BUG: Zero return from afl_shm_init."); }
|
||||
|
@ -1541,7 +1541,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
atexit(at_exit_handler);
|
||||
|
||||
size_t shm_fuzz_map_size = SHM_FUZZ_MAP_SIZE_DEFAULT;
|
||||
u8 *map = afl_shm_init(shm_fuzz, shm_fuzz_map_size, 1);
|
||||
u8 *map = afl_shm_init(shm_fuzz, shm_fuzz_map_size, 1);
|
||||
shm_fuzz->shmemfuzz_mode = true;
|
||||
if (!map) { FATAL("BUG: Zero return from afl_shm_init."); }
|
||||
|
||||
|
@ -1483,7 +1483,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
shm_fuzz->cmplog_mode = 0;
|
||||
|
||||
size_t shm_fuzz_map_size = SHM_FUZZ_MAP_SIZE_DEFAULT;
|
||||
u8 *map = afl_shm_init(shm_fuzz, shm_fuzz_map_size, 1);
|
||||
u8 *map = afl_shm_init(shm_fuzz, shm_fuzz_map_size, 1);
|
||||
shm_fuzz->shmemfuzz_mode = 1;
|
||||
if (!map) { FATAL("BUG: Zero return from afl_shm_init."); }
|
||||
|
||||
|
@ -65,9 +65,12 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#define SECTION_RODATA __attribute__((used, retain)) __attribute__((section ("__RODATA,__rodata")))
|
||||
#define SECTION_RODATA \
|
||||
__attribute__((used, retain)) __attribute__((section("__RODATA,__" \
|
||||
"rodata")))
|
||||
#else
|
||||
#define SECTION_RODATA __attribute__((used, retain)) __attribute__((section (".rodata")))
|
||||
#define SECTION_RODATA \
|
||||
__attribute__((used, retain)) __attribute__((section(".rodata")))
|
||||
#endif
|
||||
|
||||
// AFL++ shared memory fuzz cases
|
||||
@ -112,9 +115,8 @@ __attribute__((weak)) void __asan_unpoison_memory_region(
|
||||
__attribute__((weak)) void *__asan_region_is_poisoned(void *beg, size_t size);
|
||||
|
||||
// Notify AFL about persistent mode.
|
||||
SECTION_RODATA static const char AFL_PERSISTENT[] =
|
||||
"##SIG_AFL_PERSISTENT##";
|
||||
int __afl_persistent_loop(unsigned int);
|
||||
SECTION_RODATA static const char AFL_PERSISTENT[] = "##SIG_AFL_PERSISTENT##";
|
||||
int __afl_persistent_loop(unsigned int);
|
||||
|
||||
// Notify AFL about deferred forkserver.
|
||||
SECTION_RODATA static const char AFL_DEFER_FORKSVR[] =
|
||||
|
Loading…
x
Reference in New Issue
Block a user