feat(verify): store crashing input in FuzzResult for reproducibility
Assisted-by: DeepSeek V4 Pro
This commit is contained in:
+9
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user