fuzzer: don't remove or modify byte of empty input #23180
+2
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The actual patch is rather trivial, but the debugging process reveals more hidden problems. In today's episode of Who Fuzzes the Fuzzer?, I got a segfault with the following:
Relevant log:
Yes, part of the trace is missing, but I managed to pinpoint the bug to be from below when
old_input.len == 0
, leading toomitted_index == std.math.maxInt(usize)
:zig/lib/fuzzer.zig
Lines 314 to 318 in 8e0a4ca
Mysteriously, assertions are evaded, unreachables are reached, bound checks are ignored and panics don't pan above the segfaulting statement. I took a look at
lib/fuzzer/web/main.zig
'spanic
function does indeed call@trap
:zig/lib/fuzzer/web/main.zig
Lines 33 to 38 in 8e0a4ca