forked from google/syzkaller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublic_json_api.go
43 lines (39 loc) · 1.74 KB
/
public_json_api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2021 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package main
// publicApiBugDescription is used to serve the /bug HTTP requests
// and provide JSON description of the BUG. Backward compatible.
type PublicAPIBugDescription struct {
Version int `json:"version"`
Title string `json:"title,omitempty"`
Crashes []PublicAPICrashDescription `json:"crashes,omitempty"`
}
type PublicAPICrashDescription struct {
SyzReproducer string `json:"syz-reproducer,omitempty"`
CReproducer string `json:"c-reproducer,omitempty"`
KernelConfig string `json:"kernel-config,omitempty"`
KernelSourceGit string `json:"kernel-source-git,omitempty"`
KernelSourceCommit string `json:"kernel-source-commit,omitempty"`
SyzkallerGit string `json:"syzkaller-git,omitempty"`
SyzkallerCommit string `json:"syzkaller-commit,omitempty"`
CompilerDescription string `json:"compiler-description,omitempty"`
Architecture string `json:"architecture,omitempty"`
}
func GetExtAPIDescrForBugPage(bugPage *uiBugPage) *PublicAPIBugDescription {
crash := bugPage.Crashes.Crashes[0]
return &PublicAPIBugDescription{
Version: 1,
Title: bugPage.Bug.Title,
Crashes: []PublicAPICrashDescription{{
SyzReproducer: crash.ReproSyzLink,
CReproducer: crash.ReproCLink,
KernelConfig: crash.KernelConfigLink,
KernelSourceGit: crash.KernelCommitLink,
KernelSourceCommit: crash.KernelCommit,
SyzkallerGit: crash.SyzkallerCommitLink,
SyzkallerCommit: crash.SyzkallerCommit,
// TODO: add the CompilerDescription
// TODO: add the Architecture
}},
}
}