23 lines
603 B
Go
23 lines
603 B
Go
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
|||
|
|
// SPDX-License-Identifier: MIT
|
||
|
|
|
||
|
|
package rdma
|
||
|
|
|
||
|
|
import (
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
// FuzzDecodeFrame feeds arbitrary frames through the decoder: no input
|
||
|
|
// may panic or read past the declared segments.
|
||
|
|
func FuzzDecodeFrame(f *testing.F) {
|
||
|
|
f.Add([]byte{})
|
||
|
|
f.Add([]byte{0, 0, 0, 1})
|
||
|
|
f.Add(make([]byte, 64))
|
||
|
|
f.Fuzz(func(t *testing.T, data []byte) {
|
||
|
|
// The property under test is that neither decoder panics; a
|
||
|
|
// malformed frame is an ordinary error.
|
||
|
|
_, _ = DecodeFrame(data)
|
||
|
|
_, _, _, _ = ReadStreamFrame(data)
|
||
|
|
})
|
||
|
|
}
|