diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-08-19 22:08:03 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-08-20 11:01:43 +0000 |
| commit | 1157ee352849f8b61e467c77531165ac237d9246 (patch) | |
| tree | 78bab81f8bbd7bd2ac98ad3caa7c09a56b0380a2 /syz-cluster/workflow | |
| parent | 385149386b50d42ed9cae79c0b87d45ecd91303f (diff) | |
syz-cluster: fix hash comparison bugs
And improve the tests for the method.
Diffstat (limited to 'syz-cluster/workflow')
| -rw-r--r-- | syz-cluster/workflow/fuzz-step/main.go | 19 | ||||
| -rw-r--r-- | syz-cluster/workflow/fuzz-step/main_test.go | 8 |
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"}, + )) + }) } |
