mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-16 11:58:08 +00:00
mehr code cleanup
This commit is contained in:
@ -380,7 +380,7 @@
|
|||||||
after changing this - otherwise, SEGVs may ensue. */
|
after changing this - otherwise, SEGVs may ensue. */
|
||||||
|
|
||||||
#define MAP_SIZE_POW2 16
|
#define MAP_SIZE_POW2 16
|
||||||
#define MAP_SIZE (1 << MAP_SIZE_POW2)
|
#define MAP_SIZE (1U << MAP_SIZE_POW2)
|
||||||
|
|
||||||
/* Maximum allocator request size (keep well under INT_MAX): */
|
/* Maximum allocator request size (keep well under INT_MAX): */
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ typedef uint32_t u32;
|
|||||||
#define FS_OPT_SHDMEM_FUZZ 0x01000000
|
#define FS_OPT_SHDMEM_FUZZ 0x01000000
|
||||||
#define FS_OPT_OLD_AFLPP_WORKAROUND 0x0f000000
|
#define FS_OPT_OLD_AFLPP_WORKAROUND 0x0f000000
|
||||||
// FS_OPT_MAX_MAPSIZE is 8388608 = 0x800000 = 2^23 = 1 << 22
|
// FS_OPT_MAX_MAPSIZE is 8388608 = 0x800000 = 2^23 = 1 << 22
|
||||||
#define FS_OPT_MAX_MAPSIZE ((0x00fffffe >> 1) + 1)
|
#define FS_OPT_MAX_MAPSIZE ((0x00fffffeU >> 1) + 1)
|
||||||
#define FS_OPT_GET_MAPSIZE(x) (((x & 0x00fffffe) >> 1) + 1)
|
#define FS_OPT_GET_MAPSIZE(x) (((x & 0x00fffffe) >> 1) + 1)
|
||||||
#define FS_OPT_SET_MAPSIZE(x) \
|
#define FS_OPT_SET_MAPSIZE(x) \
|
||||||
(x <= 1 || x > FS_OPT_MAX_MAPSIZE ? 0 : ((x - 1) << 1))
|
(x <= 1 || x > FS_OPT_MAX_MAPSIZE ? 0 : ((x - 1) << 1))
|
||||||
|
@ -683,7 +683,7 @@ static void __afl_start_forkserver(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
u8 tmp[4] = {0, 0, 0, 0};
|
u8 tmp[4] = {0, 0, 0, 0};
|
||||||
u32 status = 0;
|
u32 status_for_fsrv = 0;
|
||||||
u32 already_read_first = 0;
|
u32 already_read_first = 0;
|
||||||
u32 was_killed;
|
u32 was_killed;
|
||||||
|
|
||||||
@ -692,11 +692,11 @@ static void __afl_start_forkserver(void) {
|
|||||||
void (*old_sigchld_handler)(int) = 0; // = signal(SIGCHLD, SIG_DFL);
|
void (*old_sigchld_handler)(int) = 0; // = signal(SIGCHLD, SIG_DFL);
|
||||||
|
|
||||||
if (__afl_map_size <= FS_OPT_MAX_MAPSIZE)
|
if (__afl_map_size <= FS_OPT_MAX_MAPSIZE)
|
||||||
status |= (FS_OPT_SET_MAPSIZE(__afl_map_size) | FS_OPT_MAPSIZE);
|
status_for_fsrv |= (FS_OPT_SET_MAPSIZE(__afl_map_size) | FS_OPT_MAPSIZE);
|
||||||
if (__afl_dictionary_len && __afl_dictionary) status |= FS_OPT_AUTODICT;
|
if (__afl_dictionary_len && __afl_dictionary) status_for_fsrv |= FS_OPT_AUTODICT;
|
||||||
if (__afl_sharedmem_fuzzing != 0) status |= FS_OPT_SHDMEM_FUZZ;
|
if (__afl_sharedmem_fuzzing != 0) status_for_fsrv |= FS_OPT_SHDMEM_FUZZ;
|
||||||
if (status) status |= (FS_OPT_ENABLED);
|
if (status_for_fsrv) status_for_fsrv |= (FS_OPT_ENABLED);
|
||||||
memcpy(tmp, &status, 4);
|
memcpy(tmp, &status_for_fsrv, 4);
|
||||||
|
|
||||||
/* Phone home and tell the parent that we're OK. If parent isn't there,
|
/* Phone home and tell the parent that we're OK. If parent isn't there,
|
||||||
assume we're not running in forkserver mode and just execute program. */
|
assume we're not running in forkserver mode and just execute program. */
|
||||||
@ -726,7 +726,6 @@ static void __afl_start_forkserver(void) {
|
|||||||
|
|
||||||
// great lets pass the dictionary through the forkserver FD
|
// great lets pass the dictionary through the forkserver FD
|
||||||
u32 len = __afl_dictionary_len, offset = 0;
|
u32 len = __afl_dictionary_len, offset = 0;
|
||||||
s32 ret;
|
|
||||||
|
|
||||||
if (write(FORKSRV_FD + 1, &len, 4) != 4) {
|
if (write(FORKSRV_FD + 1, &len, 4) != 4) {
|
||||||
|
|
||||||
@ -738,6 +737,7 @@ static void __afl_start_forkserver(void) {
|
|||||||
|
|
||||||
while (len != 0) {
|
while (len != 0) {
|
||||||
|
|
||||||
|
s32 ret;
|
||||||
ret = write(FORKSRV_FD + 1, __afl_dictionary + offset, len);
|
ret = write(FORKSRV_FD + 1, __afl_dictionary + offset, len);
|
||||||
|
|
||||||
if (ret < 1) {
|
if (ret < 1) {
|
||||||
|
Reference in New Issue
Block a user