Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ func (f *ConsumeFuzzer) fuzzStruct(e reflect.Value, customFunctions bool) error
// We check if we should check for custom functions
if customFunctions && e.IsValid() && e.CanAddr() {
err := f.setCustom(e.Addr())
if err != nil {
return err
if err == nil {
return nil
}
}

Expand Down
16 changes: 9 additions & 7 deletions funcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package gofuzzheaders

/*
import (
"testing"
)
Expand Down Expand Up @@ -42,8 +41,12 @@ type TestStructFuncs4 struct {

func TestStruct_fuzzing_CustomFuncs1(t *testing.T) {
data := []byte{
0x02, 0x41, 0x42, // Field1
0x03, 0x41, 0x42, 0x43, // Field2
// ts.Field1.Field1
0x00, 0x00, 0x00, 0x02, // 2
'A', 'B',
// ts.Field2
0x00, 0x00, 0x00, 0x03, // 3
'A', 'B', 'C',
}

ts1 := TestStructFuncs3{}
Expand All @@ -55,13 +58,13 @@ func TestStruct_fuzzing_CustomFuncs1(t *testing.T) {
t.Errorf("%v", err)
}
if ts1.Field1.Field1 != "AB" {
t.Errorf("ts1.Field1.Field1 was %v but should be 'AB'", ts1.Field1)
t.Errorf("ts1.Field1.Field1 was %v but should be 'AB'", ts1.Field1.Field1)
}
if ts1.Field1.Field2 != "staticString" {
t.Errorf("ts1.Field1.Field2 was %v but should be 'staticString'", ts1.Field1)
t.Errorf("ts1.Field1.Field2 was %v but should be 'staticString'", ts1.Field1.Field2)
}
if ts1.Field2 != "ABC" {
t.Errorf("ts1.Field1 was %v but should be 'ABC'", ts1.Field1)
t.Errorf("ts1.Field2 was %v but should be 'ABC'", ts1.Field2)
}
}

Expand All @@ -78,4 +81,3 @@ func testFuncs() []interface{} {
},
}
}
*/