summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/raw-posix.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 96f2617..7ce72e9 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)
OpenPOWER on IntegriCloud