aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster/workflow/fuzz-step
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-08-19 22:08:03 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-08-20 11:01:43 +0000
commit1157ee352849f8b61e467c77531165ac237d9246 (patch)
tree78bab81f8bbd7bd2ac98ad3caa7c09a56b0380a2 /syz-cluster/workflow/fuzz-step
parent385149386b50d42ed9cae79c0b87d45ecd91303f (diff)
syz-cluster: fix hash comparison bugs
And improve the tests for the method.
Diffstat (limited to 'syz-cluster/workflow/fuzz-step')
-rw-r--r--syz-cluster/workflow/fuzz-step/main.go19
-rw-r--r--syz-cluster/workflow/fuzz-step/main_test.go8
2 files changed, 18 insertions, 9 deletions
diff --git a/syz-cluster/workflow/fuzz-step/main.go b/syz-cluster/workflow/fuzz-step/main.go
index 954c9d25c..849b8a3bf 100644
--- a/syz-cluster/workflow/fuzz-step/main.go
+++ b/syz-cluster/workflow/fuzz-step/main.go
@@ -302,16 +302,19 @@ func shouldSkipFuzzing(baseSymbols, patchedSymbols map[string]string) bool {
log.Logf(0, "skipped the binary equality check because some of them have 0 symbols")
return false
}
- if len(baseSymbols) == len(patchedSymbols) {
- for name, hash := range baseSymbols {
- if patchedSymbols[name] != hash {
- log.Logf(0, "binaries are different, continuing fuzzing")
- return false
- }
+ same := len(baseSymbols) == len(patchedSymbols)
+ for name, hash := range baseSymbols {
+ if patchedSymbols[name] != hash {
+ same = false
+ break
}
}
- log.Logf(0, "binaries are the same, no sense to do fuzzing")
- return true
+ if same {
+ log.Logf(0, "binaries are the same, no sense to do fuzzing")
+ return true
+ }
+ log.Logf(0, "binaries are different, continuing fuzzing")
+ return false
}
func readSymbolHashes() (base, patched map[string]string, err error) {
diff --git a/syz-cluster/workflow/fuzz-step/main_test.go b/syz-cluster/workflow/fuzz-step/main_test.go
index 49ec3b330..0336281b8 100644
--- a/syz-cluster/workflow/fuzz-step/main_test.go
+++ b/syz-cluster/workflow/fuzz-step/main_test.go
@@ -39,10 +39,16 @@ func TestShouldSkipFuzzing(t *testing.T) {
map[string]string{"A": "1", "B": "2"},
))
})
- t.Run("different", func(t *testing.T) {
+ t.Run("same len, different hashes", func(t *testing.T) {
assert.False(t, shouldSkipFuzzing(
map[string]string{"A": "1", "B": "2"},
map[string]string{"A": "1", "B": "different"},
))
})
+ t.Run("different len, same hashes", func(t *testing.T) {
+ assert.False(t, shouldSkipFuzzing(
+ map[string]string{"A": "1", "B": "2", "C": "3"},
+ map[string]string{"A": "1", "B": "2"},
+ ))
+ })
}