From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFo9v-0004Sp-WB for qemu-devel@nongnu.org; Fri, 08 Aug 2014 13:41:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFo9p-0006ja-JN for qemu-devel@nongnu.org; Fri, 08 Aug 2014 13:40:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFo9p-0006jT-Cm for qemu-devel@nongnu.org; Fri, 08 Aug 2014 13:40:49 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s78HemKc029324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 8 Aug 2014 13:40:48 -0400 From: Kevin Wolf Date: Fri, 8 Aug 2014 19:39:32 +0200 Message-Id: <1407519603-6635-32-git-send-email-kwolf@redhat.com> In-Reply-To: <1407519603-6635-1-git-send-email-kwolf@redhat.com> References: <1407519603-6635-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 31/62] block: vhdx - add error check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Jeff Cody This add an error check for an invalid descriptor entry signature, when flushing the log descriptor entries. Signed-off-by: Jeff Cody Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block/vhdx-log.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/vhdx-log.c b/block/vhdx-log.c index a77c040..7c2630d 100644 --- a/block/vhdx-log.c +++ b/block/vhdx-log.c @@ -435,6 +435,11 @@ static int vhdx_log_flush_desc(BlockDriverState *bs, VHDXLogDescriptor *desc, /* write 'count' sectors of sector */ memset(buffer, 0, VHDX_LOG_SECTOR_SIZE); count = desc->zero_length / VHDX_LOG_SECTOR_SIZE; + } else { + error_report("Invalid VHDX log descriptor entry signature 0x%" PRIx32, + desc->signature); + ret = -EINVAL; + goto exit; } file_offset = desc->file_offset; -- 1.8.3.1