From 500489e312aa2e37842f85db6d9442d0ecafe9f8 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 19 Apr 2018 19:43:27 +0200 Subject: sys/syz-extract: provide readable error on missing input file Currently syz-extract crashes with nil deref panic if it is executed manually and is gives an absent file name. Output a readable error. --- sys/syz-extract/extract.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sys') diff --git a/sys/syz-extract/extract.go b/sys/syz-extract/extract.go index ade005f60..64ceff265 100644 --- a/sys/syz-extract/extract.go +++ b/sys/syz-extract/extract.go @@ -256,6 +256,9 @@ func processArch(OS OS, arch *Arch) (map[string]*compiler.ConstInfo, error) { func processFile(OS OS, arch *Arch, file *File) (map[string]uint64, map[string]bool, error) { inname := filepath.Join("sys", arch.target.OS, file.name) outname := strings.TrimSuffix(inname, ".txt") + "_" + arch.target.Arch + ".const" + if file.info == nil { + return nil, nil, fmt.Errorf("input file %v is missing", inname) + } if len(file.info.Consts) == 0 { os.Remove(outname) return nil, nil, nil -- cgit mrf-deployment