mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-10 17:21:33 +00:00
cleanup
This commit is contained in:
parent
3d031f93a6
commit
b189640a92
@ -26,15 +26,16 @@ import shutil
|
||||
with open(".clang-format") as f:
|
||||
fmt = f.read()
|
||||
|
||||
CURRENT_LLVM = os.getenv('LLVM_VERSION', 14)
|
||||
CLANG_FORMAT_BIN = os.getenv("CLANG_FORMAT_BIN", "")
|
||||
#CURRENT_LLVM = os.getenv('LLVM_VERSION', 14)
|
||||
#CLANG_FORMAT_BIN = os.getenv("CLANG_FORMAT_BIN", "")
|
||||
|
||||
if shutil.which(CLANG_FORMAT_BIN) is None:
|
||||
CLANG_FORMAT_BIN = f"clang-format-{CURRENT_LLVM}"
|
||||
#if shutil.which(CLANG_FORMAT_BIN) is None:
|
||||
# CLANG_FORMAT_BIN = f"clang-format-{CURRENT_LLVM}"
|
||||
|
||||
if shutil.which(CLANG_FORMAT_BIN) is None:
|
||||
print(f"[!] clang-format-{CURRENT_LLVM} is needed. Aborted.")
|
||||
exit(1)
|
||||
#if shutil.which(CLANG_FORMAT_BIN) is None:
|
||||
# print(f"[!] clang-format-{CURRENT_LLVM} is needed. Aborted.")
|
||||
# exit(1)
|
||||
CLANG_FORMAT_BIN = "clang-format"
|
||||
|
||||
COLUMN_LIMIT = 80
|
||||
for line in fmt.split("\n"):
|
||||
|
@ -1,4 +1,4 @@
|
||||
# argvfuzz
|
||||
#argvfuzz
|
||||
|
||||
AFL++ supports fuzzing file inputs or stdin. When source is available,
|
||||
`argv-fuzz-inl.h` can be used to change `main()` to build argv from stdin.
|
||||
@ -13,4 +13,4 @@ A few conditions need to be fulfilled for this mechanism to work correctly:
|
||||
2. If the target binary does not use the default libc's `_start` implementation
|
||||
(crt1.o), the hook may not run.
|
||||
3. The hook will replace argv with pointers to `.data` of `argvfuzz.so`. If the
|
||||
target binary expects argv to be living on the stack, things may go wrong.
|
||||
target binary expects argv to be living on the stack, things may go wrong.
|
||||
|
@ -57,18 +57,20 @@
|
||||
\
|
||||
} while (0)
|
||||
|
||||
#define AFL_INIT_ARGV_PERSISTENT(persistent_buff) \
|
||||
do { \
|
||||
argv = afl_init_argv_persistent(&argc, persistent_buff); \
|
||||
} while (0)
|
||||
#define AFL_INIT_ARGV_PERSISTENT(persistent_buff) \
|
||||
do { \
|
||||
\
|
||||
argv = afl_init_argv_persistent(&argc, persistent_buff); \
|
||||
\
|
||||
} while (0)
|
||||
|
||||
#define AFL_INIT_SET0_PERSISTENT(_p, persistent_buff) \
|
||||
do { \
|
||||
\
|
||||
argv = afl_init_argv_persistent(&argc, persistent_buff); \
|
||||
argv[0] = (_p); \
|
||||
if (!argc) argc = 1; \
|
||||
\
|
||||
#define AFL_INIT_SET0_PERSISTENT(_p, persistent_buff) \
|
||||
do { \
|
||||
\
|
||||
argv = afl_init_argv_persistent(&argc, persistent_buff); \
|
||||
argv[0] = (_p); \
|
||||
if (!argc) argc = 1; \
|
||||
\
|
||||
} while (0)
|
||||
|
||||
#define MAX_CMDLINE_LEN 100000
|
||||
@ -105,12 +107,13 @@ static char **afl_init_argv(int *argc) {
|
||||
|
||||
}
|
||||
|
||||
static char **afl_init_argv_persistent(int *argc, unsigned char *persistent_buff) {
|
||||
static char **afl_init_argv_persistent(int *argc,
|
||||
unsigned char *persistent_buff) {
|
||||
|
||||
static char *ret[MAX_CMDLINE_PAR];
|
||||
|
||||
unsigned char *ptr = persistent_buff;
|
||||
int rc = 0;
|
||||
int rc = 0;
|
||||
|
||||
while (*ptr && rc < MAX_CMDLINE_PAR) {
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "argv-fuzz-inl.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
// Initialize the argv array for use with the AFL (American Fuzzy Lop) tool
|
||||
AFL_INIT_ARGV();
|
||||
|
||||
@ -12,12 +13,16 @@ int main(int argc, char **argv) {
|
||||
an error message is printed. If the values do match, the program
|
||||
calls the abort() function. */
|
||||
if (argc > 1 && strcmp(argv[1], "XYZ") == 0) {
|
||||
if (strcmp(argv[2], "TEST2") == 0) {
|
||||
abort();
|
||||
}
|
||||
|
||||
if (strcmp(argv[2], "TEST2") == 0) { abort(); }
|
||||
|
||||
} else {
|
||||
|
||||
printf("Bad number of arguments!\n");
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ __AFL_FUZZ_INIT();
|
||||
one of the arguments.
|
||||
*/
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
#ifdef __AFL_HAVE_MANUAL_CONTROL
|
||||
__AFL_INIT();
|
||||
#endif
|
||||
@ -25,6 +26,7 @@ int main(int argc, char **argv) {
|
||||
the loop and allowing the program to terminate. It protects against
|
||||
accidental memory leaks and similar issues. */
|
||||
while (__AFL_LOOP(100000)) {
|
||||
|
||||
int len = __AFL_FUZZ_TESTCASE_LEN;
|
||||
|
||||
// Check that the length of the test case is at least 8 bytes
|
||||
@ -37,13 +39,20 @@ int main(int argc, char **argv) {
|
||||
If so, call the "abort" function to terminate the program.
|
||||
Otherwise, print an error message. */
|
||||
if (argc > 1 && strcmp(argv[1], "XYZ") == 0) {
|
||||
|
||||
if (strcmp(argv[2], "TEST2") == 0) { abort(); }
|
||||
|
||||
} else {
|
||||
|
||||
printf("Bad number of arguments!\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Exiting the loop allows the program to terminate normally. AFL will restart
|
||||
the process with a clean slate for allocated memory, file descriptors, etc.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user