Saturday, May 24, 2025
HomeGolangCompiling a fuzz-test with protection instrumentation - Getting Assist

Compiling a fuzz-test with protection instrumentation – Getting Assist


I wish to construct a fuzztest as a standalone binary, for utilization in a docker container.

Nonetheless, the binary complains that the take a look at binary was not constructed with protection instrumentation, so fuzzing will run with out protection steering and could also be inefficient.

I wish to allow the protection instrumentation.

Instance take a look at:

bundle primary

import (
	"bytes"
	"crypto/sha256"
	"testing"
)

func FuzzFoobar(f *testing.F) {
	f.Fuzz(func(t *testing.T, information []byte) {
		// Invoke some arbitrary strategies
		information = sha256.New().Sum(bytes.ToLower(information))
		if len(information) == 0 {
			panic(1)
		}
	})
}

Operating it usually works high-quality:

$ go take a look at . -fuzz Foo
fuzz: elapsed: 0s, gathering baseline protection: 0/66 accomplished
fuzz: elapsed: 0s, gathering baseline protection: 66/66 accomplished, now fuzzing with 8 employees
^Cfuzz: elapsed: 3s, execs: 107197 (39642/sec), new attention-grabbing: 8 (complete: 74)

Compiling it yields grievance:

$ go take a look at  -c .
$ ./testfuzz.take a look at -test.fuzz=Foo -test.fuzzcachedir=/tmp
warning: the take a look at binary was not constructed with protection instrumentation, so fuzzing will run with out protection steering and could also be inefficient
warning: beginning with empty corpus
fuzz: elapsed: 0s, execs: 0 (0/sec)

If I attempt to use the -cover when compiling, it doesn’t assist both:

$ go take a look at -cover -c .
$ ./testfuzz.take a look at -test.fuzz=Foo -test.fuzzcachedir=/tmp
warning: the take a look at binary was not constructed with protection instrumentation, so fuzzing will run with out protection steering and could also be inefficient
warning: beginning with empty corpus
fuzz: elapsed: 0s, execs: 0 (0/sec)

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments