Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
parallels: Check if data_end greater than the file size
Initially data_end is set to the data_off image header field and must not
be greater than the file size.

Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Denis V. Lunev <den@openvz.org>
  • Loading branch information
AlexanderIvanov-Virtuozzo authored and Denis V. Lunev committed Sep 6, 2023
1 parent fcadb48 commit 09eb64f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions block/parallels.c
Expand Up @@ -874,6 +874,11 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
*/
s->header_size = size;
}
if (s->data_end > file_nb_sectors) {
error_setg(errp, "Invalid image: incorrect data_off field");
ret = -EINVAL;
goto fail;
}

ret = bdrv_pread(bs->file, 0, s->header_size, s->header, 0);
if (ret < 0) {
Expand Down

0 comments on commit 09eb64f

Please sign in to comment.