diff --git a/ext/featurefmt/apk/apk.go b/ext/featurefmt/apk/apk.go index 2da9ebc6..f8357ba4 100644 --- a/ext/featurefmt/apk/apk.go +++ b/ext/featurefmt/apk/apk.go @@ -66,6 +66,10 @@ func (l lister) ListFeatures(files tarutil.FilesMap) ([]database.FeatureVersion, } else { ipkg.Version = version } + case line == "": + // Restart if the parser reaches another package definition before + // creating a valid package. + ipkg = database.FeatureVersion{} } // If we have a whole feature, store it in the set and try to parse a new diff --git a/ext/featurefmt/apk/testdata/installed b/ext/featurefmt/apk/testdata/installed index 747555d6..712e9465 100644 --- a/ext/featurefmt/apk/testdata/installed +++ b/ext/featurefmt/apk/testdata/installed @@ -20,6 +20,8 @@ R:ld-musl-x86_64.so.1 a:0:0:755 Z:Q1KUwsFGLHn/enpN9+QIpK/FmixtQ= +P:invalidPackageWithoutAVersion + C:Q1yhJHGSZ80L7cL0y4UKKGrBPwrUQ= P:busybox V:1.24.2-r9