(target string, panicVal interface{}, stack, input []byte)
| 81 | } |
| 82 | |
| 83 | func recordCrash(target string, panicVal interface{}, stack, input []byte) { |
| 84 | panicMsg := fmt.Sprintf("%v", panicVal) |
| 85 | sig := crashSignature(panicMsg, stack) |
| 86 | fname := filepath.Join(fuzzCrashDir, target+"_"+sig+".json") |
| 87 | f, err := os.OpenFile(fname, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644) |
| 88 | if err != nil { |
| 89 | return |
| 90 | } |
| 91 | defer f.Close() |
| 92 | inputCopy := make([]byte, len(input)) |
| 93 | copy(inputCopy, input) |
| 94 | _ = json.NewEncoder(f).Encode(map[string]interface{}{ |
| 95 | "target": target, |
| 96 | "sig": sig, |
| 97 | "panic": panicMsg, |
| 98 | "stack": string(stack), |
| 99 | "input_b64": base64.StdEncoding.EncodeToString(inputCopy), |
| 100 | }) |
| 101 | } |
| 102 | |
| 103 | func runWithCapture(target string, data []byte, fn func([]byte)) { |
| 104 | defer func() { |
no test coverage detected