Skip to content

Commit

Permalink
Fix crash when scanning architectures of corrupted APKs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vojtech Bocek committed Feb 17, 2016
1 parent 4d6ab85 commit 8f1e5fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions zipreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func (zr *ZipReaderFile) Open() error {

func (zr *ZipReaderFile) Read(p []byte) (int, error) {
if zr.internalReader == nil {
if zr.curEntry == -1 && !zr.Next() {
return 0, io.ErrUnexpectedEOF
}

if zr.curEntry >= len(zr.entries) {
return 0, io.ErrUnexpectedEOF
}
Expand Down

0 comments on commit 8f1e5fc

Please sign in to comment.