forked from Silverfish/proton-bridge
test: oss-fuzz support for fuzzing
Signed-off-by: Arjun Singh <ajsinghyadav00@gmail.com>
This commit is contained in:
committed by
Leander Beernaert
parent
cfca429067
commit
cb8174dbfd
@ -65,3 +65,23 @@ func TestUnmarshallImportExport(t *testing.T) {
|
||||
r.NoError(t, haveCredentials.Unmarshal(encoded))
|
||||
r.Equal(t, wantCredentials, haveCredentials)
|
||||
}
|
||||
|
||||
func FuzzUnmarshal(f *testing.F) {
|
||||
items := []string{
|
||||
wantCredentials.Name,
|
||||
wantCredentials.Emails,
|
||||
wantCredentials.APIToken,
|
||||
string(wantCredentials.MailboxPassword),
|
||||
"k11",
|
||||
fmt.Sprint(wantCredentials.Timestamp),
|
||||
}
|
||||
str := strings.Join(items, sep)
|
||||
f.Add([]byte(str))
|
||||
|
||||
f.Fuzz(func(t *testing.T, secret []byte) {
|
||||
encodedSecret := base64.StdEncoding.EncodeToString(secret)
|
||||
|
||||
creds := &Credentials{}
|
||||
_ = creds.Unmarshal(encodedSecret)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user