| OLD | NEW |
| 1 /* | 1 /* |
| 2 american fuzzy lop - file format analyzer | 2 american fuzzy lop - file format analyzer |
| 3 ----------------------------------------- | 3 ----------------------------------------- |
| 4 | 4 |
| 5 Written and maintained by Michal Zalewski <lcamtuf@google.com> | 5 Written and maintained by Michal Zalewski <lcamtuf@google.com> |
| 6 | 6 |
| 7 Copyright 2016 Google Inc. All rights reserved. | 7 Copyright 2016 Google Inc. All rights reserved. |
| 8 | 8 |
| 9 Licensed under the Apache License, Version 2.0 (the "License"); | 9 Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 you may not use this file except in compliance with the License. | 10 you may not use this file except in compliance with the License. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #define RESP_VARIABLE 0x02 /* Changes produce variable paths. */ | 82 #define RESP_VARIABLE 0x02 /* Changes produce variable paths. */ |
| 83 #define RESP_FIXED 0x03 /* Changes produce fixed patterns. */ | 83 #define RESP_FIXED 0x03 /* Changes produce fixed patterns. */ |
| 84 | 84 |
| 85 #define RESP_LEN 0x04 /* Potential length field */ | 85 #define RESP_LEN 0x04 /* Potential length field */ |
| 86 #define RESP_CKSUM 0x05 /* Potential checksum */ | 86 #define RESP_CKSUM 0x05 /* Potential checksum */ |
| 87 #define RESP_SUSPECT 0x06 /* Potential "suspect" blob */ | 87 #define RESP_SUSPECT 0x06 /* Potential "suspect" blob */ |
| 88 | 88 |
| 89 | 89 |
| 90 /* Classify tuple counts. This is a slow & naive version, but good enough here.
*/ | 90 /* Classify tuple counts. This is a slow & naive version, but good enough here.
*/ |
| 91 | 91 |
| 92 #define AREP4(_sym) (_sym), (_sym), (_sym), (_sym) | |
| 93 #define AREP8(_sym) AREP4(_sym), AREP4(_sym) | |
| 94 #define AREP16(_sym) AREP8(_sym), AREP8(_sym) | |
| 95 #define AREP32(_sym) AREP16(_sym), AREP16(_sym) | |
| 96 #define AREP64(_sym) AREP32(_sym), AREP32(_sym) | |
| 97 #define AREP128(_sym) AREP64(_sym), AREP64(_sym) | |
| 98 | |
| 99 static u8 count_class_lookup[256] = { | 92 static u8 count_class_lookup[256] = { |
| 100 | 93 |
| 101 /* 0 - 3: 4 */ 0, 1, 2, 4, | 94 [0] = 0, |
| 102 /* 4 - 7: +4 */ AREP4(8), | 95 [1] = 1, |
| 103 /* 8 - 15: +8 */ AREP8(16), | 96 [2] = 2, |
| 104 /* 16 - 31: +16 */ AREP16(32), | 97 [3] = 4, |
| 105 /* 32 - 127: +96 */ AREP64(64), AREP32(64), | 98 [4 ... 7] = 8, |
| 106 /* 128+: +128 */ AREP128(128) | 99 [8 ... 15] = 16, |
| 100 [16 ... 31] = 32, |
| 101 [32 ... 127] = 64, |
| 102 [128 ... 255] = 128 |
| 107 | 103 |
| 108 }; | 104 }; |
| 109 | 105 |
| 110 static void classify_counts(u8* mem) { | 106 static void classify_counts(u8* mem) { |
| 111 | 107 |
| 112 u32 i = MAP_SIZE; | 108 u32 i = MAP_SIZE; |
| 113 | 109 |
| 114 if (edges_only) { | 110 if (edges_only) { |
| 115 | 111 |
| 116 while (i--) { | 112 while (i--) { |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 "detect_leaks=0:" | 700 "detect_leaks=0:" |
| 705 "symbolize=0:" | 701 "symbolize=0:" |
| 706 "allocator_may_return_null=1", 0); | 702 "allocator_may_return_null=1", 0); |
| 707 | 703 |
| 708 setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":" | 704 setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":" |
| 709 "symbolize=0:" | 705 "symbolize=0:" |
| 710 "abort_on_error=1:" | 706 "abort_on_error=1:" |
| 711 "allocator_may_return_null=1:" | 707 "allocator_may_return_null=1:" |
| 712 "msan_track_origins=0", 0); | 708 "msan_track_origins=0", 0); |
| 713 | 709 |
| 714 if (getenv("AFL_LD_PRELOAD")) | 710 if (getenv("AFL_PRELOAD")) { |
| 715 setenv("LD_PRELOAD", getenv("AFL_LD_PRELOAD"), 1); | 711 setenv("LD_PRELOAD", getenv("AFL_PRELOAD"), 1); |
| 712 setenv("DYLD_INSERT_LIBRARIES", getenv("AFL_PRELOAD"), 1); |
| 713 } |
| 716 | 714 |
| 717 } | 715 } |
| 718 | 716 |
| 719 | 717 |
| 720 /* Setup signal handlers, duh. */ | 718 /* Setup signal handlers, duh. */ |
| 721 | 719 |
| 722 static void setup_signal_handlers(void) { | 720 static void setup_signal_handlers(void) { |
| 723 | 721 |
| 724 struct sigaction sa; | 722 struct sigaction sa; |
| 725 | 723 |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 if (!anything_set()) FATAL("No instrumentation detected."); | 1054 if (!anything_set()) FATAL("No instrumentation detected."); |
| 1057 | 1055 |
| 1058 analyze(use_argv); | 1056 analyze(use_argv); |
| 1059 | 1057 |
| 1060 OKF("We're done here. Have a nice day!\n"); | 1058 OKF("We're done here. Have a nice day!\n"); |
| 1061 | 1059 |
| 1062 exit(0); | 1060 exit(0); |
| 1063 | 1061 |
| 1064 } | 1062 } |
| 1065 | 1063 |
| OLD | NEW |