Skip to content

Commit

Permalink
fuzz: make all fuzz packages works with oss-fuzz
Browse files Browse the repository at this point in the history
oss-fuzz compile_go_fuzzer requires the package path and package name
are the same, so change all fuzz packages to satisfy it.

Updates #7921
  • Loading branch information
cuonglm committed Apr 20, 2021
1 parent 85e18bb commit 4b16037
Show file tree
Hide file tree
Showing 343 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fuzz/crypto/hd/DerivePrivateKeyForPath/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package derive
package deriveprivatekeyforpath

import (
"bytes"
Expand All @@ -13,9 +13,9 @@ func mnemonicToSeed(mnemonic string) []byte {

func Fuzz(in []byte) int {
splits := bytes.Split(in, []byte("*"))
if len(splits) == 1 {
return -1
}
if len(splits) == 1 {
return -1
}
mnemonic, path := splits[0], splits[1]
seed := mnemonicToSeed(string(mnemonic))
master, ch := hd.ComputeMastersFromSeed(seed)
Expand Down
10 changes: 10 additions & 0 deletions fuzz/oss-fuzz-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,14 @@

export FUZZ_ROOT="github.com/cosmos/cosmos-sdk"

compile_go_fuzzer "$FUZZ_ROOT"/fuzz/crypto/hd/deriveprivatekeyforpath Fuzz fuzz_crypto_hd_deriveprivatekeyforpath fuzz

compile_go_fuzzer "$FUZZ_ROOT"/fuzz/types/dec/parsecoin Fuzz fuzz_types_parsecoin fuzz
compile_go_fuzzer "$FUZZ_ROOT"/fuzz/types/dec/parsedeccoin Fuzz fuzz_types_parsedeccoin fuzz
compile_go_fuzzer "$FUZZ_ROOT"/fuzz/types/dec/parsetimebytes Fuzz fuzz_types_parsetimebytes fuzz
compile_go_fuzzer "$FUZZ_ROOT"/fuzz/types/dec/verifyaddressformat Fuzz fuzz_types_verifyaddressformat fuzz
compile_go_fuzzer "$FUZZ_ROOT"/fuzz/types/dec/setstring Fuzz fuzz_types_dec_setstring fuzz

compile_go_fuzzer "$FUZZ_ROOT"/fuzz/unknownproto Fuzz fuzz_unknownproto fuzz

compile_go_fuzzer "$FUZZ_ROOT"/fuzz/x/bank/types/addressfrombalancesstore Fuzz fuzz_x_bank_types_addressfrombalancesstore fuzz
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 4b16037

Please sign in to comment.