ensure unmarshaled entities can be marshaled back (#773)

This commit is contained in:
Alessandro Ros
2025-05-04 11:27:28 +02:00
committed by GitHub
parent 3e555e2d18
commit 7f5aac27d1
22 changed files with 89 additions and 50 deletions

View File

@@ -186,11 +186,14 @@ func FuzzRequestUnmarshal(f *testing.F) {
f.Add(ca.byts)
}
f.Fuzz(func(_ *testing.T, b []byte) {
f.Fuzz(func(t *testing.T, b []byte) {
var req Request
err := req.Unmarshal(bufio.NewReader(bytes.NewBuffer(b)))
if err == nil {
req.Marshal() //nolint:errcheck
if err != nil {
return
}
_, err = req.Marshal()
require.NoError(t, err)
})
}