From 98b28ead6ceaf22064b9715cc1950848d2bdef0b Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 27 Sep 2018 12:50:25 +0200 Subject: pkg/report: fix few fuzz bugs Improve go-fuzz fuzzer function and fix few new bugs it finds: 1. Panic in linux parser (bad). 2. Akaros can report empty rep.Report. 3. Fuchsia can return empty rep.Report. --- pkg/report/linux.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pkg/report/linux.go') diff --git a/pkg/report/linux.go b/pkg/report/linux.go index 1880298b6..97d5e84c3 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -156,6 +156,7 @@ func (ctx *linux) Parse(output []byte) *Report { rep.Report = append(rep.Report, prefix...) rep.Report = append(rep.Report, '\n') } + rep.reportPrefixLen = len(rep.Report) rep.Report = append(rep.Report, report...) if !rep.Corrupted { rep.Corrupted, rep.CorruptedReason = ctx.isCorrupted(title, report, format) @@ -377,7 +378,7 @@ func symbolizeLine(symbFunc func(bin string, pc uint64) ([]symbolizer.Frame, err } func (ctx *linux) extractGuiltyFile(rep *Report) string { - report := rep.Report[rep.StartPos:] + report := rep.Report[rep.reportPrefixLen:] if linuxRcuStall.Match(report) { // Special case for rcu stalls. // There are too many frames that we want to skip before actual guilty frames, -- cgit mrf-deployment