Skip to content

Commit

Permalink
Return an error if no .dll was instrumented
Browse files Browse the repository at this point in the history
  • Loading branch information
Metalnem committed Jun 21, 2023
1 parent 0aeaf10 commit 70ad4bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/libFuzzer.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ clang -fsanitize=fuzzer libfuzzer-dotnet.cc -o libfuzzer-dotnet

**3.** Start fuzzing by running the [fuzz-libfuzzer.ps1] script like this:

```shell
```powershell
scripts/fuzz-libfuzzer.ps1 `
-libFuzzer "libfuzzer-dotnet-windows.exe" `
-project YourFuzzingProject.csproj `
Expand Down
5 changes: 5 additions & 0 deletions scripts/fuzz-libfuzzer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ $fuzzingTargets = Get-ChildItem $outputDir -Filter *.dll `
| Where-Object { $_.Name -notin $exclusions } `
| Where-Object { $_.Name -notlike "System.*.dll" }

if (($fuzzingTargets | Measure-Object).Count -eq 0) {
Write-Error "No fuzzing targets found"
exit 1
}

foreach ($fuzzingTarget in $fuzzingTargets) {
Write-Output "Instrumenting $fuzzingTarget"
& $command $fuzzingTarget
Expand Down
5 changes: 5 additions & 0 deletions scripts/fuzz.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ $fuzzingTargets = Get-ChildItem $outputDir -Filter *.dll `
| Where-Object { $_.Name -notin $exclusions } `
| Where-Object { $_.Name -notlike "System.*.dll" }

if (($fuzzingTargets | Measure-Object).Count -eq 0) {
Write-Error "No fuzzing targets found"
exit 1
}

foreach ($fuzzingTarget in $fuzzingTargets) {
Write-Output "Instrumenting $fuzzingTarget"
& $command $fuzzingTarget
Expand Down

0 comments on commit 70ad4bb

Please sign in to comment.