| OLD | NEW |
| 1 /* | 1 /* |
| 2 american fuzzy lop - map display utility | 2 american fuzzy lop - map display utility |
| 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 2013, 2014, 2015, 2016 Google Inc. All rights reserved. | 7 Copyright 2013, 2014, 2015, 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 cmin_mode; /* Generate output in afl-cmin mode? */ | 66 cmin_mode; /* Generate output in afl-cmin mode? */ |
| 67 | 67 |
| 68 static volatile u8 | 68 static volatile u8 |
| 69 stop_soon, /* Ctrl-C pressed? */ | 69 stop_soon, /* Ctrl-C pressed? */ |
| 70 child_timed_out, /* Child timed out? */ | 70 child_timed_out, /* Child timed out? */ |
| 71 child_crashed; /* Child crashed? */ | 71 child_crashed; /* Child crashed? */ |
| 72 | 72 |
| 73 /* Classify tuple counts. Instead of mapping to individual bits, as in | 73 /* Classify tuple counts. Instead of mapping to individual bits, as in |
| 74 afl-fuzz.c, we map to more user-friendly numbers between 1 and 8. */ | 74 afl-fuzz.c, we map to more user-friendly numbers between 1 and 8. */ |
| 75 | 75 |
| 76 #define AREP4(_sym) (_sym), (_sym), (_sym), (_sym) | 76 static const u8 count_class_lookup[256] = { |
| 77 #define AREP8(_sym) AREP4(_sym), AREP4(_sym) | |
| 78 #define AREP16(_sym) AREP8(_sym), AREP8(_sym) | |
| 79 #define AREP32(_sym) AREP16(_sym), AREP16(_sym) | |
| 80 #define AREP64(_sym) AREP32(_sym), AREP32(_sym) | |
| 81 #define AREP128(_sym) AREP64(_sym), AREP64(_sym) | |
| 82 | 77 |
| 83 static u8 count_class_lookup[256] = { | 78 [0] = 0, |
| 84 | 79 [1] = 1, |
| 85 /* 0 - 3: 4 */ 0, 1, 2, 3, | 80 [2] = 2, |
| 86 /* 4 - 7: +4 */ AREP4(4), | 81 [3] = 3, |
| 87 /* 8 - 15: +8 */ AREP8(5), | 82 [4 ... 7] = 4, |
| 88 /* 16 - 31: +16 */ AREP16(6), | 83 [8 ... 15] = 5, |
| 89 /* 32 - 127: +96 */ AREP64(7), AREP32(7), | 84 [16 ... 31] = 6, |
| 90 /* 128+: +128 */ AREP128(8) | 85 [32 ... 127] = 7, |
| 86 [128 ... 255] = 8 |
| 91 | 87 |
| 92 }; | 88 }; |
| 93 | 89 |
| 94 static void classify_counts(u8* mem) { | 90 static void classify_counts(u8* mem) { |
| 95 | 91 |
| 96 u32 i = MAP_SIZE; | 92 u32 i = MAP_SIZE; |
| 97 | 93 |
| 98 if (edges_only) { | 94 if (edges_only) { |
| 99 | 95 |
| 100 while (i--) { | 96 while (i--) { |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 "detect_leaks=0:" | 335 "detect_leaks=0:" |
| 340 "symbolize=0:" | 336 "symbolize=0:" |
| 341 "allocator_may_return_null=1", 0); | 337 "allocator_may_return_null=1", 0); |
| 342 | 338 |
| 343 setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":" | 339 setenv("MSAN_OPTIONS", "exit_code=" STRINGIFY(MSAN_ERROR) ":" |
| 344 "symbolize=0:" | 340 "symbolize=0:" |
| 345 "abort_on_error=1:" | 341 "abort_on_error=1:" |
| 346 "allocator_may_return_null=1:" | 342 "allocator_may_return_null=1:" |
| 347 "msan_track_origins=0", 0); | 343 "msan_track_origins=0", 0); |
| 348 | 344 |
| 349 if (getenv("AFL_LD_PRELOAD")) | 345 if (getenv("AFL_PRELOAD")) { |
| 350 setenv("LD_PRELOAD", getenv("AFL_LD_PRELOAD"), 1); | 346 setenv("LD_PRELOAD", getenv("AFL_PRELOAD"), 1); |
| 347 setenv("DYLD_INSERT_LIBRARIES", getenv("AFL_PRELOAD"), 1); |
| 348 } |
| 351 | 349 |
| 352 } | 350 } |
| 353 | 351 |
| 354 | 352 |
| 355 /* Setup signal handlers, duh. */ | 353 /* Setup signal handlers, duh. */ |
| 356 | 354 |
| 357 static void setup_signal_handlers(void) { | 355 static void setup_signal_handlers(void) { |
| 358 | 356 |
| 359 struct sigaction sa; | 357 struct sigaction sa; |
| 360 | 358 |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 | 717 |
| 720 if (!tcnt) FATAL("No instrumentation detected" cRST); | 718 if (!tcnt) FATAL("No instrumentation detected" cRST); |
| 721 OKF("Captured %u tuples in '%s'." cRST, tcnt, out_file); | 719 OKF("Captured %u tuples in '%s'." cRST, tcnt, out_file); |
| 722 | 720 |
| 723 } | 721 } |
| 724 | 722 |
| 725 exit(child_crashed * 2 + child_timed_out); | 723 exit(child_crashed * 2 + child_timed_out); |
| 726 | 724 |
| 727 } | 725 } |
| 728 | 726 |
| OLD | NEW |