From c494b27f93d143c5547680a5d52fec7060300c9b Mon Sep 17 00:00:00 2001 From: Mark Frost Date: Fri, 25 Aug 2023 17:24:50 +0100 Subject: [PATCH] jar: skip corrupt jar file Signed-off-by: Mark Frost --- java/packagescanner.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/packagescanner.go b/java/packagescanner.go index be8f27a8d..da8d79cbf 100644 --- a/java/packagescanner.go +++ b/java/packagescanner.go @@ -174,9 +174,9 @@ func (s *Scanner) Scan(ctx context.Context, layer *claircore.Layer) ([]*claircor infos, err := jar.Parse(ctx, n, z) switch { case err == nil: - case errors.Is(err, jar.ErrUnidentified) || errors.Is(err, jar.ErrNotAJar): - // If there's an error that's one of the "known" reasons (e.g. not a - // read error or a malformed file), just log it and continue on. + case errors.Is(err, jar.ErrUnidentified) || errors.Is(err, jar.ErrNotAJar) || errors.Is(err, zip.ErrFormat): + // If there's an error that's one of the "known" reasons (e.g. not a read error), + // just log it and continue on. zlog.Info(ctx). AnErr("reason", err). Msg("skipping jar")