From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF1BL-0001zc-PG for qemu-devel@nongnu.org; Mon, 20 Jun 2016 11:32:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bF1BJ-0000TS-Ri for qemu-devel@nongnu.org; Mon, 20 Jun 2016 11:32:11 -0400 References: <20160620142623.24471-1-mreitz@redhat.com> <20160620142623.24471-3-mreitz@redhat.com> From: Eric Blake Message-ID: <57680C6E.8090107@redhat.com> Date: Mon, 20 Jun 2016 09:31:58 -0600 MIME-Version: 1.0 In-Reply-To: <20160620142623.24471-3-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3SNSJsSV7rAM3NlgvuN11UKUbNjsRSuKw" Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 2/2] qcow2: Fix qcow2_get_cluster_offset() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-block@nongnu.org Cc: Kevin Wolf , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3SNSJsSV7rAM3NlgvuN11UKUbNjsRSuKw From: Eric Blake To: Max Reitz , qemu-block@nongnu.org Cc: Kevin Wolf , qemu-devel@nongnu.org Message-ID: <57680C6E.8090107@redhat.com> Subject: Re: [Qemu-block] [PATCH 2/2] qcow2: Fix qcow2_get_cluster_offset() References: <20160620142623.24471-1-mreitz@redhat.com> <20160620142623.24471-3-mreitz@redhat.com> In-Reply-To: <20160620142623.24471-3-mreitz@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/20/2016 08:26 AM, Max Reitz wrote: > Recently, qcow2_get_cluster_offset() has been changed to work with byte= s > instead of sectors. This invalidated some assertions and introduced a > possible integer multiplication overflow. >=20 > This could be reproduced using e.g. >=20 > $ qemu-img create -f qcow2 -o cluster_size=3D1M blub.qcow2 8G > Formatting 'foo.qcow2', fmt=3Dqcow2 size=3D8589934592 encryption=3Doff > cluster_size=3D1048576 lazy_refcounts=3Doff refcount_bits=3D16 > $ qemu-io -c map blub.qcow2 > qemu-io: qemu/block/qcow2-cluster.c:504: qcow2_get_cluster_offset: > Assertion `bytes_needed <=3D INT_MAX' failed. > [1] 20775 abort (core dumped) qemu-io -c map foo.qcow2 >=20 > This patch removes the now wrong assertion, adding comments and more > assertions to prove its correctness (and fixing the overflow which woul= d > become apparent with the original assertion removed). >=20 > Signed-off-by: Max Reitz > --- > block/qcow2-cluster.c | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) >=20 Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --3SNSJsSV7rAM3NlgvuN11UKUbNjsRSuKw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXaAxuAAoJEKeha0olJ0Nqfk8H/j0H9qAcgJsohIJ+q80HTgzA rlYLtJepWhTt0/fIBKatH0W+cw8+Eho4uY0UzwhfSIRDAgO0KO+f9+4svT9xaaLh s0+4Hp8QQJMlghH+rviQ9OVpshbgNz0P+Z78RcnRuCMaxS3dU32AVuIuWF++MHQg 1gZjqnlTh/YMKhaQjVz6q9zLagUlJfZK94a7SS3qtfGp035cL/eZZtlAxH3gTAgY ZpLu6Uf958M+5btbSf8xCT4YmscdI6eFkDEv3KkKG4nOIW/WIJa44ZDgoCw48Xht PwW6y79vkFcTqWS85YdNhYC6f7R3TuSljXj+o/8em4NGHL96LCtyiwTTCyK1znw= =9q4E -----END PGP SIGNATURE----- --3SNSJsSV7rAM3NlgvuN11UKUbNjsRSuKw--