mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 22:56:48 +00:00
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
@ -18,6 +18,7 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -50,3 +51,18 @@ func getFileAsString(filename string) string {
|
||||
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func FuzzNewParser(f *testing.F) {
|
||||
inSeed1, err1 := os.ReadFile(filepath.Join("testdata", "text_html_octet_attachment.eml"))
|
||||
inSeed2, err2 := os.ReadFile(filepath.Join("testdata", "complex_structure.eml"))
|
||||
|
||||
require.NoError(f, err1)
|
||||
require.NoError(f, err2)
|
||||
|
||||
f.Add(inSeed1)
|
||||
f.Add(inSeed2)
|
||||
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
_, _ = New(bytes.NewReader(data))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user