From 52d40fd252bb12a2d5ec5573ce4d03b63682dfdc Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 29 Apr 2023 14:36:39 +0200 Subject: 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. --- sys/syz-extract/extract.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'sys/syz-extract') 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 { -- cgit mrf-deployment