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

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