]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.fuzz] internal/fuzz: maintain debug info during minimization
authorRoland Shoemaker <roland@golang.org>
Thu, 2 Sep 2021 21:38:58 +0000 (14:38 -0700)
committerRoland Shoemaker <roland@golang.org>
Fri, 3 Sep 2021 18:34:56 +0000 (18:34 +0000)
Change-Id: I70c0229e43dfe37f70b9c79c2e6fe88d7b8d7bd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/347231
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/internal/fuzz/fuzz.go
src/internal/fuzz/worker.go

index 722933a0bf483f259226cf6226a7ede8200633f1..5b940e4929b81e838e7293220a2d75e28c497f86 100644 (file)
@@ -341,10 +341,11 @@ func CoordinateFuzzing(ctx context.Context, opts CoordinateFuzzingOpts) (err err
                                        if printDebugInfo() {
                                                fmt.Fprintf(
                                                        c.opts.Log,
-                                                       "DEBUG worker reported interesting input that doesn't expand coverage, elapsed: %s, id: %s, parent: %s\n",
+                                                       "DEBUG worker reported interesting input that doesn't expand coverage, elapsed: %s, id: %s, parent: %s, minimized: %t\n",
                                                        time.Since(c.startTime),
                                                        result.entry.Name,
                                                        result.entry.Parent,
+                                                       result.minimizeAttempted,
                                                )
                                        }
                                }
index 2f5704094ea65611a6861c707d941fb915f9224f..32b13662c8c0f1907df0760a1a8a368c90e3c81d 100644 (file)
@@ -1017,6 +1017,11 @@ func (wc *workerClient) minimize(ctx context.Context, entryIn CorpusEntry, args
                return CorpusEntry{}, minimizeResponse{}, errSharedMemClosed
        }
        entryOut.Data = mem.valueCopy()
+       h := sha256.Sum256(entryOut.Data)
+       name := fmt.Sprintf("%x", h[:4])
+       entryOut.Name = name
+       entryOut.Parent = entryIn.Parent
+       entryOut.Generation = entryIn.Generation
        resp.Count = mem.header().count
 
        return entryOut, resp, callErr