Merge pull request #362 from jzelinskie/malformedpkg
Handle Parsing of Malformed Packages
This commit is contained in:
commit
b5f4e0f3a3
@ -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
|
||||
|
2
ext/featurefmt/apk/testdata/installed
vendored
2
ext/featurefmt/apk/testdata/installed
vendored
@ -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
|
||||
|
@ -97,6 +97,9 @@ func (l lister) ListFeatures(files tarutil.FilesMap) ([]database.FeatureVersion,
|
||||
} else {
|
||||
pkg.Version = version
|
||||
}
|
||||
} else if line == "" {
|
||||
pkg.Feature.Name = ""
|
||||
pkg.Version = ""
|
||||
}
|
||||
|
||||
// Add the package to the result array if we have all the informations
|
||||
|
2
ext/featurefmt/dpkg/testdata/status
vendored
2
ext/featurefmt/dpkg/testdata/status
vendored
@ -60,6 +60,8 @@ This package is not necessary for most modern Linux systems, where the udev
|
||||
subsystem provides a more dynamic mechanism for device file management.
|
||||
Original-Maintainer: Debian QA Group <packages@qa.debian.org>
|
||||
|
||||
Package: brokenPackageWithNoVersionThatShouldGetThrownOut
|
||||
|
||||
Package: libgcc1
|
||||
Status: install ok installed
|
||||
Priority: required
|
||||
|
Loading…
Reference in New Issue
Block a user