diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-04-19 19:43:27 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-04-19 19:43:27 +0200 |
| commit | 500489e312aa2e37842f85db6d9442d0ecafe9f8 (patch) | |
| tree | 2f8e9940b1721407659ad51a5223792c7af8b8ba /sys/syz-extract/extract.go | |
| parent | e5453dd396fe0c59fcc58fa888910285c91be7db (diff) | |
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.
Diffstat (limited to 'sys/syz-extract/extract.go')
| -rw-r--r-- | sys/syz-extract/extract.go | 3 |
1 files changed, 3 insertions, 0 deletions
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 |
