From 20b63df30902ca4e09e00e323b0d013b25bc959e Mon Sep 17 00:00:00 2001 From: Ritesh Noronha Date: Fri, 23 Aug 2024 12:10:38 -0700 Subject: [PATCH] Prevent segv when files are not present --- pkg/engine/score.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/engine/score.go b/pkg/engine/score.go index 765d679..fcc448b 100644 --- a/pkg/engine/score.go +++ b/pkg/engine/score.go @@ -181,7 +181,13 @@ func handlePaths(ctx context.Context, ep *Params) error { paths = append(paths, sbomFilePath) } else { log.Debugf("Processing path :%s\n", path) - pathInfo, _ := os.Stat(path) + pathInfo, err := os.Stat(path) + if err != nil { + log.Debugf("os.Stat failed for path:%s\n", path) + log.Infof("%s\n", err) + continue + } + if pathInfo.IsDir() { files, err := os.ReadDir(path) if err != nil {