diff --git a/block/raw-posix.c b/block/raw-posix.c index 96f26173e..7ce72e9e4 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -391,8 +391,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)