mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
Merge pull request 'fix bugs with handling fuzzing crashes' (#32033) from gooncreeper/zig:fuzz-crash-report-bugs into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32033 Reviewed-by: Andrew Kelley <andrew@ziglang.org>
This commit is contained in:
@@ -2166,11 +2166,15 @@ const FuzzTestRunner = struct {
|
||||
const result = completion.result;
|
||||
switch (completion.index % 3) {
|
||||
0 => try f.completeStdinWrite(id, result.file_write_streaming catch |e| switch (e) {
|
||||
error.BrokenPipe => return f.instanceEos(id),
|
||||
// Avoid calling `instanceEos` until EndOfStream is seen with stderr so
|
||||
// that all stderr is collected.
|
||||
error.BrokenPipe => continue,
|
||||
else => |write_e| return write_e,
|
||||
}),
|
||||
1 => try f.completeStdoutRead(id, result.file_read_streaming catch |e| switch (e) {
|
||||
error.EndOfStream => return f.instanceEos(id),
|
||||
// Avoid calling `instanceEos` until EndOfStream is seen with stderr so
|
||||
// that all stderr is collected.
|
||||
error.EndOfStream => continue,
|
||||
else => |read_e| return read_e,
|
||||
}),
|
||||
2 => try f.completeStderrRead(id, result.file_read_streaming catch |e| switch (e) {
|
||||
@@ -2360,7 +2364,10 @@ const FuzzTestRunner = struct {
|
||||
var in_name_buf: [12]u8 = undefined;
|
||||
var in_name: []const u8 = undefined;
|
||||
var i: u32 = 0;
|
||||
const header: InputHeader = while (true) {
|
||||
const header: InputHeader = while (true) : ({
|
||||
if (i == std.math.maxInt(u32)) return;
|
||||
i += 1;
|
||||
}) {
|
||||
const name_prefix = "f" ++ Io.Dir.path.sep_str ++ "in";
|
||||
in_name = std.fmt.bufPrint(&in_name_buf, name_prefix ++ "{x}", .{i}) catch unreachable;
|
||||
in_f = b.cache_root.handle.openFile(io, in_name, .{
|
||||
@@ -2394,8 +2401,6 @@ const FuzzTestRunner = struct {
|
||||
}
|
||||
|
||||
in_f.close(io);
|
||||
if (i == std.math.maxInt(u32)) return;
|
||||
i += 1;
|
||||
};
|
||||
defer in_f.close(io);
|
||||
|
||||
@@ -2479,7 +2484,7 @@ const FuzzTestRunner = struct {
|
||||
const step_owner = f.run.step.owner;
|
||||
const arena = step_owner.allocator;
|
||||
|
||||
// Collect any remaining stderr
|
||||
// Collect any available stderr
|
||||
while (f.batch.next()) |completion| {
|
||||
if (completion.index % 3 != 2) continue;
|
||||
const len = completion.result.file_read_streaming catch continue;
|
||||
|
||||
Reference in New Issue
Block a user