Skip to content

Commit

Permalink
Adjust which cases in PE parsing return errors
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
  • Loading branch information
luhring committed Jul 19, 2023
1 parent e42fd77 commit 95b25f8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions syft/pkg/cataloger/dotnet/parse_dotnet_portable_executable.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,21 @@ func parseDotnetPortableExecutable(_ file.Resolver, _ *generic.Environment, f fi

versionResources, err := peFile.ParseVersionResources()
if err != nil {
return nil, nil, err
// this is not a fatal error, just log and continue
// TODO: consider this case for "known unknowns" (same goes for cases below)
log.Tracef("unable to parse version resources in PE file: %s", f.RealPath)
return nil, nil, nil
}

name := versionResources["FileDescription"]
if name == "" {
log.Debugf("unable to find FileDescription in PE file: %s", f.RealPath)
log.Tracef("unable to find FileDescription in PE file: %s", f.RealPath)
return nil, nil, nil
}

version := versionResources["FileVersion"]
if version == "" {
log.Debugf("unable to find FileVersion in PE file: %s", f.RealPath)
log.Tracef("unable to find FileVersion in PE file: %s", f.RealPath)
return nil, nil, nil
}

Expand Down

0 comments on commit 95b25f8

Please sign in to comment.