From 354c3244659f5a81d9ccbdb4cddceeda30b90e9d Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 10 Oct 2017 10:41:27 +0200 Subject: syz-fuzzer: don't send/check CallIndex for inputs The call index check episodically fails: 2017/10/02 22:07:32 bad call index 1, calls 1, program: under unknown circumstances. I've looked at the code again and don't see where/how we can mess CallIndex. Added a new test for minimization that especially checks resulting CallIndex. It would be good to understand what happens, but we don't have any reproducers. CallIndex is actually unused at this point. Manager only needs call name. So remove CallIndex entirely. --- prog/mutation_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'prog/mutation_test.go') diff --git a/prog/mutation_test.go b/prog/mutation_test.go index 4e9bb626a..1fe2da9eb 100644 --- a/prog/mutation_test.go +++ b/prog/mutation_test.go @@ -6,6 +6,7 @@ package prog import ( "bytes" "fmt" + "math/rand" "testing" ) @@ -310,3 +311,18 @@ func TestMinimizeRandom(t *testing.T) { }, false) } } + +func TestMinimizeCallIndex(t *testing.T) { + target, rs, iters := initTest(t) + r := rand.New(rs) + for i := 0; i < iters; i++ { + p := target.Generate(rs, 5, nil) + ci := r.Intn(len(p.Calls)) + p1, ci1 := Minimize(p, ci, func(p1 *Prog, callIndex int) bool { + return r.Intn(2) == 0 + }, r.Intn(2) == 0) + if ci1 < 0 || ci1 >= len(p1.Calls) || p.Calls[ci].Meta.Name != p1.Calls[ci1].Meta.Name { + t.Fatalf("bad call index after minimization") + } + } +} -- cgit mrf-deployment