diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2023-04-29 14:36:39 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2023-05-02 10:51:44 +0200 |
| commit | 52d40fd252bb12a2d5ec5573ce4d03b63682dfdc (patch) | |
| tree | 0829613ac77dbb92a61b0939867ae22d783f28e4 | |
| parent | 62df2017e3b1edd786a4c737bd4ccba2b4581d88 (diff) | |
sys/syz-extract: fix meta checking when using explicit file list
If syz-extract is executed with explicit file list and some of these
files have meta tags that exclude them from processing for an arch,
currently it leads to "const info for input file is missing" error.
Check meta tags even for explicit file list.
| -rw-r--r-- | sys/syz-extract/extract.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/syz-extract/extract.go b/sys/syz-extract/extract.go index 40ed37f87..adcb1d0ac 100644 --- a/sys/syz-extract/extract.go +++ b/sys/syz-extract/extract.go @@ -181,6 +181,11 @@ func createArches(OS string, archArray, files []string) ([]*Arch, int, error) { if allFiles == nil { return nil, 0, fmt.Errorf("%v", errBuf.String()) } + if len(files) == 0 { + for file := range allFiles { + files = append(files, file) + } + } nfiles := 0 var arches []*Arch for _, archStr := range archArray { @@ -210,14 +215,16 @@ func createArches(OS string, archArray, files []string) ([]*Arch, int, error) { build: *flagBuild, done: make(chan bool), } - archFiles := files - if len(archFiles) == 0 { - for file, meta := range allFiles { - if meta.NoExtract || !meta.SupportsArch(archStr) { - continue - } - archFiles = append(archFiles, file) + var archFiles []string + for _, file := range files { + meta, ok := allFiles[file] + if !ok { + return nil, 0, fmt.Errorf("unknown file: %v", file) + } + if meta.NoExtract || !meta.SupportsArch(archStr) { + continue } + archFiles = append(archFiles, file) } sort.Strings(archFiles) for _, f := range archFiles { |
