Skip to content

Commit

Permalink
Fix read-after-eof panic (#10)
Browse files Browse the repository at this point in the history
Fixed a panic that was caused when Read() was called after a previous Read() returned io.EOF
  • Loading branch information
srmish-jfrog authored Dec 3, 2023
1 parent c4f6a70 commit 1b6c170
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ext4/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ func (f *File) Stat() (fs.FileInfo, error) {
}

func (f *File) Read(p []byte) (n int, err error) {
if f.buffer == nil {
return 0, io.EOF
}
if f.buffer.Len() == 0 {
f.currentBlock++
if f.currentBlock*f.blockSize >= f.Size() {
Expand Down

0 comments on commit 1b6c170

Please sign in to comment.