From 1b6c170bbf8830a502fef3ec39411a3935d8eb26 Mon Sep 17 00:00:00 2001 From: Shachar Menashe <92059693+srmish-jfrog@users.noreply.github.com> Date: Sun, 3 Dec 2023 16:15:04 +0200 Subject: [PATCH] Fix read-after-eof panic (#10) Fixed a panic that was caused when Read() was called after a previous Read() returned io.EOF --- ext4/file.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext4/file.go b/ext4/file.go index ab06cd7..4ce6191 100644 --- a/ext4/file.go +++ b/ext4/file.go @@ -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() {