diff --git a/block/raw-posix.c b/block/raw-posix.c
index 4d79881..6ef1cff 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -403,8 +403,12 @@ static int raw_pread(BlockDriverState *bs, int64_t offset,
                     size = ALIGNED_BUFFER_SIZE;
 
                 ret = raw_pread_aligned(bs, offset, s->aligned_buf, size);
-                if (ret < 0)
+                if (ret < 0) {
                     return ret;
+                } else if (ret == 0) {
+                    fprintf(stderr, "raw_pread: read beyond end of file\n");
+                    abort();
+                }
 
                 size = ret;
                 if (size > count)
