From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LaGhM-0008ET-01 for qemu-devel@nongnu.org; Thu, 19 Feb 2009 16:44:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LaGhJ-0008Cm-Op for qemu-devel@nongnu.org; Thu, 19 Feb 2009 16:44:47 -0500 Received: from [199.232.76.173] (port=55673 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LaGhJ-0008Cg-LQ for qemu-devel@nongnu.org; Thu, 19 Feb 2009 16:44:45 -0500 Received: from moutng.kundenserver.de ([212.227.126.187]:52090) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LaGhJ-0005y8-2F for qemu-devel@nongnu.org; Thu, 19 Feb 2009 16:44:45 -0500 Received: from localhost ([127.0.0.1] ident=stefan) by flocke.weilnetz.de with esmtp (Exim 4.69) (envelope-from ) id 1LaGhE-0001sU-Mm for qemu-devel@nongnu.org; Thu, 19 Feb 2009 22:44:40 +0100 Message-ID: <499DD2C8.1050606@mail.berlios.de> Date: Thu, 19 Feb 2009 22:44:40 +0100 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/4] vmdk: check for negative sector nums also References: <1235078376-25559-1-git-send-email-ehabkost@redhat.com> <1235078376-25559-2-git-send-email-ehabkost@redhat.com> In-Reply-To: <1235078376-25559-2-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Eduardo Habkost schrieb: > Signed-off-by: Eduardo Habkost > --- > block-vmdk.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/block-vmdk.c b/block-vmdk.c > index 71d7504..416fb95 100644 > --- a/block-vmdk.c > +++ b/block-vmdk.c > @@ -649,7 +649,7 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num, > Why is sector_num signed? An unsigned quantity would simplify the code below (no need to check for < 0). > uint64_t cluster_offset; > static int cid_update = 0; > > - if (sector_num > bs->total_sectors) { > + if (sector_num < 0 || sector_num > bs->total_sectors) { > fprintf(stderr, > "(VMDK) Wrong offset: sector_num=0x%" PRIx64 > " total_sectors=0x%" PRIx64 "\n", > Regards Stefan Weil