diff --git a/block.c b/block.c index 990a7542a9495ade8237e7b13a68216cc6300bd2..3b7951eb4f887b0a9c6f3a950528a40ab16db0d7 100644 --- a/block.c +++ b/block.c @@ -2601,7 +2601,7 @@ static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, static int bdrv_check_request(BlockDriverState *bs, int64_t sector_num, int nb_sectors) { - if (nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) { + if (nb_sectors < 0 || nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) { return -EIO; }