Skip to content

Commit

Permalink
ignore elf sections without ReaderAt
Browse files Browse the repository at this point in the history
Ignore sections that are compressed. There may be a more elaborate fix
using `Section.Open`, but this should be sufficient. It's likely now
with `embed` usage of this package will be going down.

Fixes #6.
See golang/go#54227 for more context.
  • Loading branch information
daaku committed Nov 9, 2022
1 parent 74d766a commit db143eb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zipexe.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ func zipExeReaderElf(rda io.ReaderAt, size int64) (*zip.Reader, error) {
}

// Check if this section has a zip file
if zfile, err := zip.NewReader(sect, int64(sect.Size)); err == nil {
return zfile, nil
if sect.ReaderAt != nil {
if zfile, err := zip.NewReader(sect, int64(sect.Size)); err == nil {
return zfile, nil
}
}

// Otherwise move end of file pointer
Expand Down

0 comments on commit db143eb

Please sign in to comment.