Skip to content

Commit

Permalink
Fix divide by zero panic
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Korczynski <adam@adalogics.com>
  • Loading branch information
AdamKorcz committed Aug 7, 2024
1 parent f06394e commit 6b32908
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 6b32908

Please sign in to comment.