feat(verify): store crashing input in FuzzResult for reproducibility
Test / vet (push) Successful in 44s
Test / test (push) Successful in 1m59s
Test / build (push) Successful in 36s

Assisted-by: DeepSeek V4 Pro
This commit is contained in:
2026-08-04 21:58:53 +02:00
parent 32afa3449f
commit 36bbc0c13b
+9 -1
View File
@@ -20,6 +20,7 @@ type FuzzResult struct {
Matches int Matches int
Mismatches int Mismatches int
FirstFail string // description of the first mismatch ("" if none) 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. // OK returns true when all iterations matched.
@@ -30,8 +31,12 @@ func (r FuzzResult) String() string {
if r.OK() { if r.OK() {
return fmt.Sprintf("%s: %d/%d iterations match", r.Func, r.Matches, r.Iterations) 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) 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. // 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. // (e.g. histogram increments) don't corrupt the other's input.
gasmArgs, goArgs, bufs := genDualArgs(rng, sig, fl.Args) gasmArgs, goArgs, bufs := genDualArgs(rng, sig, fl.Args)
// Save the current input for crash diagnostics.
result.CrashInput = gasmArgs
// Call the gasm version. // Call the gasm version.
gasmOut, err := k.CallFunc(name, gasmArgs) gasmOut, err := k.CallFunc(name, gasmArgs)
if err != nil { if err != nil {