| ... | ... | @@ -703,7 +703,7 @@ const Fuzzer = struct { |
| 703 | 703 | else => panic("failed to read corpus file '{s}': {t}", .{ name, e }), |
| 704 | 704 | }; |
| 705 | 705 | defer gpa.free(bytes); |
| 706 | | f.newInput(bytes, false); |
| 706 | f.newInputExternal(bytes); |
| 707 | 707 | } |
| 708 | 708 | f.corpus_pos = @enumFromInt(0); |
| 709 | 709 | } |
| ... | ... | @@ -861,7 +861,16 @@ const Fuzzer = struct { |
| 861 | 861 | } |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | | pub fn newInput(f: *Fuzzer, bytes: []const u8, modify_fs_corpus: bool) void { |
| 864 | pub fn newInputExternal(f: *Fuzzer, bytes: []const u8) void { |
| 865 | // All inputs including the corpus are required to go through the memory |
| 866 | // mapped input in case they cause a crash so they can be identified. |
| 867 | f.mmap_input.appendSlice(bytes); |
| 868 | f.newInput(false); |
| 869 | f.mmap_input.clearRetainingCapacity(); |
| 870 | } |
| 871 | |
| 872 | fn newInput(f: *Fuzzer, modify_fs_corpus: bool) void { |
| 873 | const bytes = f.mmap_input.inputSlice(); |
| 865 | 874 | f.runBytes(bytes, .bytes_fresh); |
| 866 | 875 | f.req_values = f.input_builder.total_ints + f.input_builder.total_bytes; |
| 867 | 876 | f.req_bytes = @intCast(f.input_builder.bytes_table.items.len); |
| ... | ... | @@ -1081,7 +1090,7 @@ const Fuzzer = struct { |
| 1081 | 1090 | @branchHint(.unlikely); |
| 1082 | 1091 | |
| 1083 | 1092 | _ = @atomicRmw(usize, &exec.seenPcsHeader().unique_runs, .Add, 1, .monotonic); |
| 1084 | | f.newInput(f.mmap_input.inputSlice(), true); |
| 1093 | f.newInput(true); |
| 1085 | 1094 | } |
| 1086 | 1095 | f.mmap_input.clearRetainingCapacity(); |
| 1087 | 1096 | |
| ... | ... | @@ -1675,7 +1684,7 @@ export fn fuzzer_set_test(test_one: abi.TestOne, unit_test_name: abi.Slice) void |
| 1675 | 1684 | |
| 1676 | 1685 | export fn fuzzer_new_input(bytes: abi.Slice) void { |
| 1677 | 1686 | if (bytes.len == 0) return; // An entry of length zero is always present |
| 1678 | | fuzzer.newInput(bytes.toSlice(), false); |
| 1687 | fuzzer.newInputExternal(bytes.toSlice()); |
| 1679 | 1688 | } |
| 1680 | 1689 | |
| 1681 | 1690 | export fn fuzzer_main(limit_kind: abi.LimitKind, amount: u64) void { |