Skip to content

Commit

Permalink
Merge pull request #28 from AdamKorcz/divide-by-zero
Browse files Browse the repository at this point in the history
Fix divide by zero panic
  • Loading branch information
jandubois authored Aug 7, 2024
2 parents f06394e + 6b32908 commit 86f804d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions image/qcow2/qcow2.go
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,10 @@ func (img *Qcow2) ReadAt(p []byte, off int64) (n int, err error) {
err = img.errUnreadable
return
}
if img.clusterSize == 0 {
err = errors.New("cluster size cannot be 0")
return
}
if len(p) == 0 {
return
}
Expand Down

0 comments on commit 86f804d

Please sign in to comment.