add: new go-fuzz targets

Signed-off-by: Arjun <pkillarjun@protonmail.com>
This commit is contained in:
Arjun
2024-11-11 20:26:12 +05:30
parent 1f3e3045ad
commit 53c523444e
5 changed files with 67 additions and 0 deletions

View File

@@ -254,3 +254,18 @@ func (u *UDP) EncodeLayers() ([]gopacket.SerializableLayer, error) {
udpLayer.SetNetworkLayerForChecksum(ipLayers[0].(gopacket.NetworkLayer))
return append(ipLayers, &udpLayer), nil
}
func FuzzIPDecoder(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
ipDecoder := NewIPDecoder()
ipDecoder.Decode(RawPacket{Data: data})
})
}
func FuzzICMPDecoder(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
icmpDecoder := NewICMPDecoder()
icmpDecoder.Decode(RawPacket{Data: data})
})
}