From nobody Wed Nov 5 16:36:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535644297788101.91700315593039; Thu, 30 Aug 2018 08:51:37 -0700 (PDT) Received: from localhost ([::1]:49577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvPEN-000864-Qm for importer@patchew.org; Thu, 30 Aug 2018 11:51:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvPCH-0006Y2-Cm for qemu-devel@nongnu.org; Thu, 30 Aug 2018 11:49:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvP8b-0005g2-NX for qemu-devel@nongnu.org; Thu, 30 Aug 2018 11:45:41 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:44776) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvP8b-0005bU-Av for qemu-devel@nongnu.org; Thu, 30 Aug 2018 11:45:37 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w7UFdFJb030693 for ; Thu, 30 Aug 2018 15:45:36 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2m2y2pwhj6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 30 Aug 2018 15:45:36 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w7UFjYZd011026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 30 Aug 2018 15:45:35 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w7UFjYIM017482 for ; Thu, 30 Aug 2018 15:45:34 GMT Received: from ol7.uk.oracle.com (/10.175.215.81) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 30 Aug 2018 08:45:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=37tlN+uNEbXiAuG12LZsugPUOLPaqdHi0hOXiFXHC9o=; b=Aqg/iDWpKGRwT3IWgbtmN+gTEE/L+1YlzFL9XVqKEG3HdJpvi7dTUldUvwtOh/An2qKV tBCXnU4N2+kh8g03NyrBIzS/hKV5A+/dgGPD/jRdkGaYrqqVuPz4uLR3Jbd7ibm5K/O3 7Kpete7+KDalpyLeiAf/0GYN2GPRx+toUfhBnd5Hh6lzMKWVaPHDU/WUvXbaVunWXuR3 VngYUeV7odMRvHLvT9lrY0okRSS9VqGAf0KEDDgE1nkwmHsvN5NAIfeC7vqv1va2cwUx XX3f9z47q5LVjbkJnnC3TmwTP0MHlH7ZZ42kNjghEHg8cMftoMOJe4ORlPhJrg5yNovy jQ== From: Liam Merwick To: qemu-devel@nongnu.org Date: Thu, 30 Aug 2018 16:47:11 +0100 Message-Id: <1535644031-848-9-git-send-email-Liam.Merwick@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1535644031-848-1-git-send-email-Liam.Merwick@oracle.com> References: <1535644031-848-1-git-send-email-Liam.Merwick@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9000 signatures=668708 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=863 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808300162 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 141.146.126.78 Subject: [Qemu-devel] [PATCH 8/8] qcow2: Read outside array bounds in qcow2_pre_write_overlap_check() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The commit for 0e4e4318eaa5 increments QCOW2_OL_MAX_BITNR but does not add an array entry for QCOW2_OL_BITMAP_DIRECTORY_BITNR to metadata_ol_names= []. As a result, an array dereference of metadata_ol_names[8] in qcow2_pre_write_overlap_check() could result in a read outside of the array= bounds. Fixes: 0e4e4318eaa5 ('qcow2: add overlap check for bitmap directory') Cc: Vladimir Sementsov-Ogievskiy Signed-off-by: Liam Merwick Reviewed-by: Darren Kenny Reviewed-by: Mark Kanda --- block/qcow2-refcount.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 3c539f02e5ec..6504e7421324 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -2719,14 +2719,15 @@ int qcow2_check_metadata_overlap(BlockDriverState *= bs, int ign, int64_t offset, } =20 static const char *metadata_ol_names[] =3D { - [QCOW2_OL_MAIN_HEADER_BITNR] =3D "qcow2_header", - [QCOW2_OL_ACTIVE_L1_BITNR] =3D "active L1 table", - [QCOW2_OL_ACTIVE_L2_BITNR] =3D "active L2 table", - [QCOW2_OL_REFCOUNT_TABLE_BITNR] =3D "refcount table", - [QCOW2_OL_REFCOUNT_BLOCK_BITNR] =3D "refcount block", - [QCOW2_OL_SNAPSHOT_TABLE_BITNR] =3D "snapshot table", - [QCOW2_OL_INACTIVE_L1_BITNR] =3D "inactive L1 table", - [QCOW2_OL_INACTIVE_L2_BITNR] =3D "inactive L2 table", + [QCOW2_OL_MAIN_HEADER_BITNR] =3D "qcow2_header", + [QCOW2_OL_ACTIVE_L1_BITNR] =3D "active L1 table", + [QCOW2_OL_ACTIVE_L2_BITNR] =3D "active L2 table", + [QCOW2_OL_REFCOUNT_TABLE_BITNR] =3D "refcount table", + [QCOW2_OL_REFCOUNT_BLOCK_BITNR] =3D "refcount block", + [QCOW2_OL_SNAPSHOT_TABLE_BITNR] =3D "snapshot table", + [QCOW2_OL_INACTIVE_L1_BITNR] =3D "inactive L1 table", + [QCOW2_OL_INACTIVE_L2_BITNR] =3D "inactive L2 table", + [QCOW2_OL_BITMAP_DIRECTORY_BITNR] =3D "bitmap directory", }; =20 /* --=20 1.8.3.1