Add fuzz tests, rename fuzz tests and fix panic found by fuzzing (#72)

* begin adding better fuzz test

* finish adding working fuzzer

* implement mutateipv4

* fuzzer finds a panic in ICMP client on receive empty payload

* rename fuzz tests to reflect fuzz methodology
This commit is contained in:
Pat Whittingslow
2026-04-11 11:09:51 -03:00
committed by GitHub
parent 68461b4416
commit 66a1aec593
226 changed files with 835 additions and 20 deletions
+16
View File
@@ -164,6 +164,11 @@ func (h *Handler) Read(b []byte) (int, error) {
return n, nil
}
// IsOpen returns true if the handler can send/receive data.
func (h *Handler) IsOpen() bool {
return !h.closeCalled && h.lport > 0
}
// Close closes the connection. Calls to [Handler.Send] and [Handler.Recv] will
// return [net.ErrClosed] after Close is called.
func (h *Handler) Close() {
@@ -212,3 +217,14 @@ func (h *Handler) SizeInput() int {
func (h *Handler) SizeOutput() int {
return h.txRing.Size()
}
// FreeOutput returns the number of free bytes in the transmit buffer.
// This tells the user how many bytes can be written with Write method before write failing.
func (h *Handler) FreeOutput() int {
return h.txRing.Free()
}
// FreeInput returns the number of free bytes in the receive buffer.
func (h *Handler) FreeInput() int {
return h.rxRing.Free()
}