Skip to content

Commit

Permalink
add default path
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalpharush committed Sep 9, 2024
1 parent 37c0f38 commit ba3d9c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 0 additions & 3 deletions fuzzing/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,6 @@ func (p *ProjectConfig) Validate() error {

// The coverage report format must be either "lcov" or "html"
if p.Fuzzing.CoverageReports != nil {
if p.Fuzzing.CorpusDirectory == "" {
return errors.New("project configuration must specify a corpus directory if coverage reports are enabled")
}
for _, report := range p.Fuzzing.CoverageReports {
if report != "lcov" && report != "html" {
return errors.New(fmt.Sprintf("project configuration must specify only valid coverage reports (lcov, html): %s", report))
Expand Down
8 changes: 6 additions & 2 deletions fuzzing/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,12 @@ func (f *Fuzzer) Start() error {
f.printExitingResults()

// Finally, generate our coverage report if we have set a valid corpus directory.
if err == nil && f.config.Fuzzing.CorpusDirectory != "" && len(f.config.Fuzzing.CoverageReports) > 0 {
coverageReportDir := filepath.Join(f.config.Fuzzing.CorpusDirectory, "coverage")
if err == nil && len(f.config.Fuzzing.CoverageReports) > 0 {
// Write to the default directory if we have no corpus directory set.
coverageReportDir := filepath.Join("crytic-export", "coverage")
if f.config.Fuzzing.CorpusDirectory != "" {
coverageReportDir = filepath.Join(f.config.Fuzzing.CorpusDirectory, "coverage")
}
sourceAnalysis, err := coverage.AnalyzeSourceCoverage(f.compilations, f.corpus.CoverageMaps())

if err != nil {
Expand Down

0 comments on commit ba3d9c4

Please sign in to comment.