diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2017-11-22 13:37:30 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-11-22 13:41:47 +0100 |
| commit | c8b87c9cf704f1e3a11fc0ca7cf610631265b3c1 (patch) | |
| tree | 40892a3ba0a26ac468bbfb8e78c00fe21af5bc92 /pkg/report/linux.go | |
| parent | 53a23f2a379f1d6982bef00164556d2dff7a3229 (diff) | |
pkg/report: fix corrupted KASAN reports detection
KASAN report might not have Allocated or Freed stack traces at all.
Diffstat (limited to 'pkg/report/linux.go')
| -rw-r--r-- | pkg/report/linux.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pkg/report/linux.go b/pkg/report/linux.go index a1489a553..dde5d29aa 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -348,15 +348,16 @@ func (ctx *linux) isCorrupted(title string, report []byte) bool { } } if strings.HasPrefix(title, "KASAN") { - // For KASAN reports lets use 'Allocated' and 'Freed' as signals. - if !bytes.Contains(report, []byte("Allocated")) { + // KASAN reports must contain 'Call Trace' after 'KASAN:' header. + match := bytes.Index(report, []byte("KASAN:")) + if match == -1 { return true } - if !bytes.Contains(report, []byte("Freed")) { + if !bytes.Contains(report[match:], []byte("Call Trace")) { return true } } - // When a report contains 'Call trace', 'backtrace', 'Allocated' or 'Freed' keywords, + // When a report contains 'Call Trace', 'backtrace', 'Allocated' or 'Freed' keywords, // it must also contain at least a single stack frame after the first of them. stackKeywords := []string{"Call Trace", "backtrace", "Allocated", "Freed"} stackLocation := -1 |
