Skip to content

Commit

Permalink
ext/featurefmt/apk: handle malformed packages
Browse files Browse the repository at this point in the history
  • Loading branch information
jzelinskie committed Apr 11, 2017
1 parent 590e7e2 commit b2f2b2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/featurefmt/apk/apk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ext/featurefmt/apk/testdata/installed
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b2f2b2c

Please sign in to comment.