Skip to content
Snippets Groups Projects
Unverified Commit c587ad22 authored by Daniel Czerwonk's avatar Daniel Czerwonk Committed by GitHub
Browse files

Merge pull request #101 from hikhvar/update-fuzzing

Update fuzzing to new Decode API
parents 55cf3d2a 0475daa0
No related branches found
No related tags found
No related merge requests found
Showing
with 34 additions and 8 deletions
packet-fuzz.zip
crashers
suppressions
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
// +build gofuzz
// foobar
// +bu ild go fuzz
package packet
import "bytes"
import (
"bytes"
"github.com/bio-routing/bio-rd/protocols/bgp/types"
)
const (
INC_PRIO = 1
......@@ -13,13 +18,32 @@ const (
func Fuzz(data []byte) int {
buf := bytes.NewBuffer(data)
msg, err := Decode(buf)
if err != nil {
if msg != nil {
panic("msg != nil on error")
for _, option := range getAllOptions() {
msg, err := Decode(buf, &option)
if err != nil {
if msg != nil {
panic("msg != nil on error")
}
}
return KEEP
return INC_PRIO
}
return KEEP
}
return INC_PRIO
func getAllOptions() []types.Options {
parameters := []bool{true, false}
var ret []types.Options
for _, octet := range parameters {
for _, multi := range parameters {
for _, addPathX := range parameters {
ret = append(ret, types.Options{
Supports4OctetASN: octet,
SupportsMultiProtocol: multi,
AddPathRX: addPathX,
})
}
}
}
return ret
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment