1// Copyright 2017 syzkaller project authors. All rights reserved. 2// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4// +build gofuzz 5 6package report 7 8import ( 9 "regexp" 10) 11 12var reporter, _ = NewReporter("linux", "", "", nil, []*regexp.Regexp{regexp.MustCompile("foo")}) 13 14func FuzzLinux(data []byte) int { 15 containsCrash := reporter.ContainsCrash(data) 16 rep := reporter.Parse(data) 17 if containsCrash != (rep != nil) { 18 panic("ContainsCrash and Parse disagree") 19 } 20 if rep == nil { 21 return 0 22 } 23 if rep.Title == "" { 24 panic("rep.Title == \"\"") 25 } 26 if len(rep.Report) == 0 { 27 panic("len(rep.Report) == 0") 28 } 29 if len(rep.Output) == 0 { 30 panic("len(rep.Output) == 0") 31 } 32 if rep.StartPos >= rep.EndPos { 33 panic("rep.StartPos >= rep.EndPos") 34 } 35 return 1 36} 37