From 0c5c53600de3e6434d9d0cd41b01f11028f84be2 Mon Sep 17 00:00:00 2001 From: Emmanuel T Odeke Date: Mon, 7 Nov 2022 08:01:42 -0800 Subject: [PATCH] chore: [types/bech32] add a fuzzer for DecodeAndConvert (#13775) --- types/bech32/bech32_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/types/bech32/bech32_test.go b/types/bech32/bech32_test.go index ba2beb7832..e39086fb9d 100644 --- a/types/bech32/bech32_test.go +++ b/types/bech32/bech32_test.go @@ -23,3 +23,16 @@ func TestEncodeAndDecode(t *testing.T) { require.Equal(t, hrp, ss, "Invalid hrp") require.True(t, bytes.Equal(data, sum[:]), "Invalid decode") } + +func FuzzDecodeAndConvert(f *testing.F) { + if testing.Short() { + f.Skip() + } + + f.Add("shasum149yfqne0parehrupja55kvqcfvxja5wpe54pas8mshffngvj53rs93fk75") + f.Add("bech321er8m900ayvv9rg5r6ush4nzvqhj4p9tqnxqkxaaxrs4ueuvhurcs4x3j4j") + + f.Fuzz(func(t *testing.T, str string) { + _, _, _ = bech32.DecodeAndConvert(str) + }) +}