From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W63GV-0001Qs-AZ for qemu-devel@nongnu.org; Wed, 22 Jan 2014 14:15:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W63GQ-0003tD-KP for qemu-devel@nongnu.org; Wed, 22 Jan 2014 14:15:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W63GQ-0003od-Bf for qemu-devel@nongnu.org; Wed, 22 Jan 2014 14:15:02 -0500 Message-ID: <52E0191C.2070209@redhat.com> Date: Wed, 22 Jan 2014 20:16:44 +0100 From: Max Reitz MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 2/4] qcow2: fix offset overflow in qcow2_alloc_clusters_at() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao , qemu-devel@nongnu.org Cc: Kevin Wolf On 22.01.2014 07:57, Hu Tao wrote: > When cluster size is big enough it can lead offset overflow > in qcow2_alloc_clusters_at(). This patch fixes it. > > The allocation each time is stopped at L2 table boundary > (see handle_alloc()), so the possible maximum bytes could be > > 2^(cluster_bits - 3 + cluster_bits) > > so int is safe for cluster_bits<=17, unsafe otherwise. > > Signed-off-by: Hu Tao > --- > block/qcow2-refcount.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) Reviewed-by: Max Reitz