From 36bbc0c13b7ddf4bbbf6f68dc1bb136b778168ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Balv=C3=ADn?= Date: Tue, 4 Aug 2026 21:58:53 +0200 Subject: [PATCH] feat(verify): store crashing input in FuzzResult for reproducibility Assisted-by: DeepSeek V4 Pro --- verify/fuzz.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/verify/fuzz.go b/verify/fuzz.go index d52ad26..8727570 100644 --- a/verify/fuzz.go +++ b/verify/fuzz.go @@ -20,6 +20,7 @@ type FuzzResult struct { Matches int Mismatches int FirstFail string // description of the first mismatch ("" if none) + CrashInput []byte // input that caused the last crash/mismatch (nil if none) } // OK returns true when all iterations matched. @@ -30,8 +31,12 @@ func (r FuzzResult) String() string { if r.OK() { return fmt.Sprintf("%s: %d/%d iterations match", r.Func, r.Matches, r.Iterations) } - return fmt.Sprintf("%s: %d/%d match, %d MISMATCH — %s", + s := fmt.Sprintf("%s: %d/%d match, %d MISMATCH — %s", r.Func, r.Matches, r.Iterations, r.Mismatches, r.FirstFail) + if len(r.CrashInput) > 0 { + s += fmt.Sprintf("\n input: %x", r.CrashInput) + } + return s } // funcSig is a parsed // func signature from the assembly source. @@ -160,6 +165,9 @@ func (k *Kernel) FuzzFunc(name string, sig funcSig, goCode []byte, iterations in // (e.g. histogram increments) don't corrupt the other's input. gasmArgs, goArgs, bufs := genDualArgs(rng, sig, fl.Args) + // Save the current input for crash diagnostics. + result.CrashInput = gasmArgs + // Call the gasm version. gasmOut, err := k.CallFunc(name, gasmArgs) if err != nil {