zimmski / tavor

A generic fuzzing and delta-debugging framework
MIT License
245 stars 10 forks source link

Strategies are crashing when given a nil random generator #88

Closed yblein closed 9 years ago

yblein commented 9 years ago

Strategies actually using the given random generator are not checking is the pointer is nil and therefore crashing on a nil dereference if it was. For instance with RandomStrategy:

panic: runtime error: invalid memory address or nil pointer dereference
[...]
github.com/zimmski/tavor/fuzz/strategy.(*RandomStrategy).fuzz(0xc208036f80, 0x7ffa4a63ae10, 0xc2080d4180, 0x0, 0x0, 0xc2080366d0)
    github.com/zimmski/tavor/fuzz/strategy/random.go:72 +0x30d
github.com/zimmski/tavor/fuzz/strategy.func·009()
    github.com/zimmski/tavor/fuzz/strategy/random.go:44 +0x1bf
created by github.com/zimmski/tavor/fuzz/strategy.(*RandomStrategy).Fuzz
    github.com/zimmski/tavor/fuzz/strategy/random.go:60 +0x225
[...]

A better error message would be nice.